Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-Size QR Code #55

Closed
PeterA1 opened this issue Dec 19, 2016 · 6 comments
Closed

Re-Size QR Code #55

PeterA1 opened this issue Dec 19, 2016 · 6 comments

Comments

@PeterA1
Copy link

PeterA1 commented Dec 19, 2016

Hi,

I want to re-size the .png produced for a QR code. If I apply a scale the QR code produced is smaller, but the QR code has white space to the top and right?

Any help appreciated.

image

Peter

@metafloor
Copy link
Owner

Can you provide some example input parameters/options so I can understand the issues you are seeing?

@PeterA1
Copy link
Author

PeterA1 commented Dec 20, 2016

Here's the version # and Options currently in use.

Using bwip-js@1.1.1

image

@metafloor
Copy link
Owner

There is a bug here that I believe we also saw in issue #53. But fortunately for your use case, there is a work around until I can track down the error.

At scale factor 1, each "module" of the qr-symbol is a 2x2 square. At scale factor 2, each module is a 4x4 square. The only possible size in between those would use a scale factor of 1.5. Specifying scale:1.65 is causing the extra padding.

I just verified that this works without adding padding using both the online demo and the online API. For example, this produces a qr-symbol with a 3x3 module size and no extra padding:

http://api-bwipjs.rhcloud.com/?bcid=qrcode&text=http%3A%2F%2Fgoo.gl%2F0bis&eclevel=M&scale=1.5

@RUSHt
Copy link

RUSHt commented Dec 20, 2016

Thanks, the 1.5 Ratio sorted the Skewed Padding.

However I did notice that if I set Options { scale: 1.5, paddingwidth: 5, paddingheight: 5 } then I got...

blankbarcode

(Above is an empty .png).....

@metafloor
Copy link
Owner

It turns out the padding works when the scale factor is an integer, but not when fractional. I have a fix for the issue and will roll-out a new release later today.

@liu-minjie
Copy link

It turns out the padding works when the scale factor is an integer, but not when fractional. I have a fix for the issue and will roll-out a new release later today.

fractional still not work, @metafloor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants