I'm trying to generate QR code using zxing, but the image i create
does not decode / or the decoder fails to recognize.
Here is my code . You mentioned that you were successful in generating
QRcode with PNGencoder, can you provide me how you did that. If you
can provide code that will great.
thanks.
public static void main(String[] args) {
QRCodeWriter q = new QRCodeWriter();
try {
ByteMatrix bm = q.encode("hello",
BarcodeFormat.QR_CODE, 100,
100);
BufferedImage i = toBufferedImage(bm);
ImageIO.write(i, "PNG", new File("a2.png"));
} catch (WriterException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static BufferedImage toBufferedImage(ByteMatrix matrix) {
int width = matrix.getWidth();
int height = matrix.getHeight();
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, matrix.get(y, x));
}
}
return image;
}
On Dec 21, 10:32 am, mably <[email protected]> wrote:
> Hi Roberto, thanx for your answer.
>
> I finally succeeded generating QRCodes with the ZXing QRCode encoder
> and a home made PNGEncoder (derivated from the ones found there
> :http://catcode.com/pngencoder/).
>
> But I'm still stuck with Datamatrix bar codes coz ZXing doesn't
> generate them.
>
> Any help will be greatly appreciated.
>
> François
>
> On 20 déc, 18:27, Roberto Saccon <[email protected]> wrote:
>
> > There is a sample app with ZXing, which runs on GAE, but I don't know
> > exactly what it does, but I think to encode QRCodes (generating an
> > image) isn't that difficult, I recently did that (just for a test) in
> > Javascript, with an Open source code I found after 2 seconds of
> > Googeling. If you want to decode Images, then I think the ZXing code
> > has some AWT dependencies, which aren't GAE whitelisted.
> > --
> > Roberto
>
> > On Dec 20, 12:16 pm, mably <[email protected]> wrote:
>
> > > More generally, has anybody heard of an open source barcode generator
> > > java library running on GAE ?
>
> > > We need to generate QR Codes or Datamatrix bar codes from our
> > > application running on GAE.
>
> > > We are using the Google Charts API for generating QR Codes for the
> > > moment.
>
> > > Thanx for you help.
>
> > > On 19 déc, 18:50, mably <[email protected]> wrote:
>
> > > > Has anyone successfully used Google ZXing library on GAE for
> > > > generating QR Codes ?
>
> > > > Thanx for your help.
>
> > > > François
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.