I am using the google open source java zxing creator: http://code.google.com/p/zxing/
to create QR codes. I have everything in place and working (I'm loading the java files using coldfusion and writing the image to the browser.)
What I want now is to change the black QR colour to something else. Is there an easy way of doing this?
Would I need to edit a decompiled version of the encoder java file? Or is there a way I could add a color argument to the encoding routine?
Thanks Shaun
Try this ::
In
MatrixToImageWriter.java
(which I assume you are using), underjavase/
change the constantBLACK
. It is anint
in ARGB format and currently has value0xFF000000
. Leave the alpha value at0xFF
. Change the rest to describe your color in hex format. You can do the same withWHITE
if you like.I assume that you're generating qr code like below:
Your output's dimension will be based on your code. Set your dimension as possible as low. So you can find exact positions of qr code place you want to change color.
Than get your pixels from bitmap with:
And color pixels you want:
Convert dp to px for every devices:
Finaly set your colored pixels to bitmap:
This's how i solved the problem. I hope this'll help you.