-
-
Notifications
You must be signed in to change notification settings - Fork 721
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
Is it possible to make QR code with logo at the center #314
Comments
Hi @vinayk7 one way would be to add the padding to the image you place over the QR code but then you would probably have some QR code blocks with partial overlap. If you want to avoid this partial overlap I suggest you either generate the matrix before like this.
This gives you the block size etc. so you can exactly calculate the desired image width and height. Another option is to create your own writer based on the PNG writer and put the logo calculation logic there. In other words: it is possible but not out of the box. Good luck! |
@endroid and @vinayk7 I am also looking to do this. @endroid please would you expand on your comment as to how it could be used with the following?
|
Hi @mstnorris if you need a centered logo exactly the size of a specific number of blocks (with no overlap) like @vinayk7 you should first generate the matrix like you do in your example. As soon as you know all dimensions, margins and the block size you can use this in your own implementation / writer where you resize and place the image exactly based on the matrix dimensions and block size. |
@endroid I reopen this post to find out if it is now possible to have a rendering like the one above easily? |
Hi @benja2111 the matrix consists of the block size, the x,y values (0=white, 1=black) and the inner width and outer width that indicate the image width excluding and including the margin. You can use that information to make a square in the middle that exactly fits and place an image in the middle. How to do that is up to you, I have no algorithm that does that for you as mentioned above ;) If you have a working solution feel free to open a PR. Good luck! |
I wish this explanations where a little bit easier to understand. |
I wanted to know is it possible to create a QR something like this?
Note the center padding so it avoids the logo touching the nearby QR pixels
The text was updated successfully, but these errors were encountered: