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
MatrixToImageWriter(int ARGOncolor,int ARGOffcolor) not changing colour of the barcode #1397
Comments
Please check the second answer of this question on stack overflow |
That function doesn't seem to produce the correct ints - not sure what the logic of the return statement is but |
I tried your suggestion, still getting that same black & white 128 barcode. I changed the dimensions of the BitMatrix but still the same result |
Hm, I think you don't want transparency, so you need to ensure the top byte is |
Even if I pass |
Works fine for me. Are you sure you're reading the right path? Ex:
|
It's working now. Thanks a lot man. You're a lifesaver |
Bug Reports
I was using this function to create a colorful barcode but the output was plain black& white barcode.
This is the part where I used a function I created RGB which takes 2 integers (red,green,blue values) as parameter & returns an ARGB int value to work with.
The code was working till last night but I don't know for some reason it's not working now.
BitMatrix matrix = writer.encode(text, BarcodeFormat.CODE_128, 500, 300);
MatrixToImageConfig conf = new MatrixToImageConfig(RGB(0,0,255),RGB(0,255,0));
BufferedImage qrcode = MatrixToImageWriter.toBufferedImage(matrix, conf);
File outputfile = new File(path);
ImageIO.write(qrcode, "png", outputfile);
Here's the declaration of the RGB function:-
private static int RGB(int red,int green,int blue) {
int rgb=(65536*red+256*green+blue);
return ((16777215-rgb)*(-1));
}
Here's the resultant barcode128 image
And here's the console output:-
On Color = -16776960
Off Color = -16711935
The text was updated successfully, but these errors were encountered: