Closed momolly1024 closed 2 years ago
I'm not sure what you mean by "image" in this context.
isEmpty()
methodIf you mean checking if the signature canvas is empty, there is already a method for that, isEmpty()
.
canvas
is, but is out-of-scopeIf you mean checking if a dataURL is empty as you do in your code sample, I'm not sure if that is even possible. A quick search finds this unanswered SO question.
It can work on my local , but not work for other computer .
I've done some dataURL computation before, and indeed, if I recall correctly, an empty canvas has a different dataURL on different browsers. Similar to my research for #49 , I believe this depends on the browser's implementation of the canvas, which will differ.
canvas
If you're not using isEmpty()
and want to check if a canvas
element is empty, here's an SO answer with a few different ways of checking if a canvas is empty.
trim-canvas
(used by this library for .getTrimmedCanvas()
and also maintained by me) implements some similar logic as one of the ways in that SO answer.
Those will avoid using a raw dataURL and compute on the canvas
element instead.
In any case, either computation on a raw dataURL or on a raw canvas
element is out-of-scope for this library, which maintains a signature API wrapper specifically and already implements isEmpty()
for signatures as per my first paragraph.
Hi :) Dose any way to check if image is empty ? First I try to
It can work on my local , but not work for other computer .
So, i wonder if there have another solution.
Thanks.