• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java get image from BufferedImage Zxing QR Code

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi my question is the next, im doing a qr code in java with zxing jar.

I create the qr code and save in my computer, but i dont want write the qr code in the computer, i want get the image for use inside my code and add in a pdf file.


My code is the next





In this code im writing the image in the computer, i was thinking in return the BitMatrix object and make the conversion to image, and save in a image variable. But i dont know how to get the image.
 
Marshal
Posts: 74054
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's Zxing? Is it a kind of exclusive or, or an app for picture manipulation?

Discussion added to our GUIs forum.
 
mike salazar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:What's Zxing? Is it a kind of exclusive or, or an app for picture manipulation?

Discussion added to our GUIs forum.



Is a library for make barcode or qr code
Staff note (Ron McLeod) :

Project repository: https://github.com/zxing/zxing

 
Master Rancher
Posts: 4465
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how to get the image.


Are you asking about the variable named image declared on line 26?
 
mike salazar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

how to get the image.


Are you asking about the variable named image declared on line 26?



no sorry, my question is about this




in this line is writting the image to the path in the computer, i want return the image instead of write the image to the path
 
Norm Radder
Master Rancher
Posts: 4465
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i want return the image


To return an object from a method, declare the method to return the class of the object and use a return statement to return the object.
Look at the java tutorial:  https://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html
 
Marshal
Posts: 22457
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use MatrixToImageWriter to write a BitMatrix to a file or an output stream, or convert it into a BufferedImage. How that can be embedded in a PDF file depends on the PDF library you use.
 
Saloon Keeper
Posts: 24325
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might be of service: https://stackoverflow.com/questions/10354858/qr-code-generation-into-scalable-eps-with-java

Since QR codes are images there are several ways to put them in a PDF. The two primary ways are as a bitmapped image or as PostScript. Bitmapped images originally were in TIFF form, but as far as I know, modern PDFs can handle things like PNG directly.

PostScript (and SVG) are the better option, since they're actual graphic commands and render cleanly regardless of how you zoom in or out or print. Bitmapped images can become blurred or distorted when scaled. PostScript, incidentally, is the "machine language" of PDFs and EPS.

PostScript is a programming language, so if desired you could actually generate a rendering program PS function for QR output and feed it a string of bit values. Or, take the easy way out and just render a matrix of black and white rectangles.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any programming language that is easy to use for Barcode Conversion?
 
Tim Holloway
Saloon Keeper
Posts: 24325
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Christine Salvador wrote:Is there any programming language that is easy to use for Barcode Conversion?



Output of simple bar codes are generally just implemented as fonts. So any language that can print "Hello, World!" and do some elementary checksum calculations can write barcodes.

Although you can also just render the bars manually via the graphics library. Same result, but more work.

Reading bar codes is more work, so that's usually done using a pre-debugged library. There's no programming language that's barcode-specific, though.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, what do you mean by "conversion".
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic