Henrik Kristiansen
unread,Jan 20, 2013, 6:06:12 AM1/20/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zx...@googlegroups.com
I'm using the following code to generate a QR code:
String input = "hello world";
QRCodeWriter writer = new QRCodeWriter();
Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
BitMatrix mtx = writer.encode(input, BarcodeFormat.QR_CODE, WIDTH, HEIGHT, hints);
if (mtx != null) {
MatrixToImageConfig matrixToImageConfig = new MatrixToImageConfig(0xFF000000, -1);
BufferedImage image = MatrixToImageWriter.toBufferedImage(mtx, matrixToImageConfig);
ImageIO.write(image, "png", new File("C:\\New folder\\output.png"));
}
Is it somehow possible to set a transparent background? When I enable the alpha channel on the white color in the MatrixToImageConfig the whole image turns black.
Is it somehow possible to specify color space and image dpi?