jjacksn
asked on
How to read Tiff file in Java (Is JAI the correct way?)
I'm trying to get a Tiff file into a buffered image to feed to an API that looks for barcodes. I have looked around the web and found a couple of ways to do it, one of them is here:
http://forum.java.sun.com/thread.jspa?threadID=560162&messageID=9429770
Is JAI what I should be using here?
I also have this sample code:
PlanarImage im = null;
im = JAI.create("fileload", file.getAbsolutePath());
im.getAsBufferedImage();
and also not sure if that is the way to go. The person's project I am trying to edit only including JAI_codec.jar, so I do not believe I have access to the JAI object.
http://forum.java.sun.com/thread.jspa?threadID=560162&messageID=9429770
Is JAI what I should be using here?
I also have this sample code:
PlanarImage im = null;
im = JAI.create("fileload", file.getAbsolutePath());
im.getAsBufferedImage();
and also not sure if that is the way to go. The person's project I am trying to edit only including JAI_codec.jar, so I do not believe I have access to the JAI object.
ASKER
That returns a null object in my unit test. could it be that I have a badly formatted tiff file? tiff file loads fine in windows.
ASKER
jai_codec.jar is included in my build path as well
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks it works well client. Trying to to do this in a servlet now and its not working although the unit tests are working client side. I'm guessing that I'm not exporting the jar into the WAR file, although i have it checked in the J2EE module dependencies in eclipse. Is there a programmatic check i can do in the servlet to make sure it has access to jai_imageio.jar?
add a new question here:
https://www.experts-exchange.com/questions/23430412/how-to-check-if-a-jar-file-is-in-the-build-path.html
add a new question here:
https://www.experts-exchange.com/questions/23430412/how-to-check-if-a-jar-file-is-in-the-build-path.html
:-)
We'll sort it out
We'll sort it out
Open in new window