Signature_pad: FromDataURL reducing image size

Created on 15 May 2015  ·  7Comments  ·  Source: szimek/signature_pad

Hello,

If I save a signature to a database using the toDataURL() function, and then I load that string back into the canvas using the fromDataURL() function, then the resulting image appears in the canvas but is noticeably smaller than the original image.

To test, draw in the canvas along all 4 edges. Save and then reload. You will see that the right-side and bottom-sides of the image now have space between the image and the border because the image was made slightly smaller.

Since I re-save images over and over for a good reason, they keep shrinking with each save!!!

Help!

Most helpful comment

To make the same image size you can add options
signaturePad.fromDataURL(data, {width: 100, height: 100})
width, height should be the same as canvas size
More details:
https://github.com/szimek/signature_pad/blob/master/src/signature_pad.ts

All 7 comments

Hmm, this happens only on Retina Display, I just reproduced it. You must deal with it yourself somehow, the creator said already multiple times that the library should not take care of this.

It seems that this solves the problem:
http://jsfiddle.net/4JH75/19/

I am experiencing the same issue with device pixel ratio 1. Any help?

To make the same image size you can add options
signaturePad.fromDataURL(data, {width: 100, height: 100})
width, height should be the same as canvas size
More details:
https://github.com/szimek/signature_pad/blob/master/src/signature_pad.ts

Thanks to your last answer, we can now fix the problem with fromDataURL scaling issues, should close this issue.

Thanks a lot for the response "demo-igor"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zuldra picture Zuldra  ·  4Comments

davidosuna1987 picture davidosuna1987  ·  11Comments

cristhianDt picture cristhianDt  ·  7Comments

erangaapp picture erangaapp  ·  8Comments

c2ofh picture c2ofh  ·  7Comments