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

QRCode white border #88

Closed
GuilhE opened this issue Apr 6, 2017 · 2 comments
Closed

QRCode white border #88

GuilhE opened this issue Apr 6, 2017 · 2 comments

Comments

@GuilhE
Copy link

GuilhE commented Apr 6, 2017

Hello,
Is it possible to remove the border created around the QRCode or change its size?
I can always crop it or manipulate the bitmap, but it would be nice to have a lib's method to do so.

Thanks.

ps: I'm using it for Android.

@GuilhE
Copy link
Author

GuilhE commented Apr 6, 2017

Ok I've found a way :)


int myMargin = 0;
Bitmap qrCode = QRCode.from(data).withHint(EncodeHintType.MARGIN, myMargin).bitmap();

That's how you manipulate the margin.
Funny thing is, with margin = 0 you still have a little margin. So If you want to completely remove it I guess you'll have to manipulate the bitmap:

Example:
Bitmap croppedBitmap = Bitmap.createBitmap(qrCode, 20, 20, qrCode.getWidth() - 40, qrCode.getHeight() - 40);

@kenglxn
Copy link
Owner

kenglxn commented Jun 29, 2017

Thanks for posting your solution. Will be helpful to others with the same question.

@kenglxn kenglxn closed this as completed Jun 29, 2017
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

2 participants