问题
I am using zxing (java) to generate qr codes and want to know a method to add logo to the qr code. Is there any built in method for adding logo to it or any alternate for same.
回答1:
You will have to add an image overlay perhaps using another image library. I managed to find this resource that was able to do it. http://skrymerdev.wordpress.com/2012/09/22/qr-code-generation-with-zxing/
However I am certain you cannot add an image directly in the center of an QR code it will not allow the QR code to scan. You may be able to put a small one at the top.

回答2:
You can use set
, setRegion
and flip
methods of output BitMatrix
to change bits in output matrix, and add any (if you have a good error correction level) monochrome image in your output code, or you can export your BitMatrix
to mutable Image
and do whatever you want with Image.getGraphics()
, which gives you built-in Graphics
object where you can draw as usual, but don't forget to increase your ERROR_CORRECTION level.
来源:https://stackoverflow.com/questions/18296555/how-to-add-logo-to-qr-codes