ImageIo.read() doesn't work.the error tells that ImageIo class doesn't contains read method.like
ByteArrayInputStream bais=new ByteArrayInputStream(logo);
BufferedImage bimage=ImageIO.read(bais);
any one help me?
ImageIo is part of JRE not directly to android, so you may face problem!!
visit http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html
and we can say that Android is not stand art java - it lacks certain classes. what can be suggested is you can go for similar approaches and try to find out some similar straight solution or library project which can help you .
Imaging libraries are not a part of Android development kit. if you want to display images in android you should use BitMap and BitMap Factory classes provided with Android.
Related
I'm trying to decode a QR code which is in a jpeg image, that I post to AppEngine, in the Java version.
I have tried to use ZXing, but couldn't manage to. The obvious solution would be to use their 'Javase' module, but that needs to use BufferedImage and ImageIO, which are not available in AppEngine.
Is there some alternate solution?
You could use the zxing online decoder:
QR code example:
http://thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/images/qrcode_dvp.png
php script example:
file_get_contents('http://zxing.org/w/decode?u=thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/images/qrcode_dvp.png');
A very good tutorial (in french):
http://thierry-leriche-dessirier.developpez.com/tutoriels/java/creer-qrcode-zxing-java2d-5-min/
Try bundling the BufferedImage and ImageIO jar files into the WEB-INF/lib directory of your project or perhaps the Referenced Libraries of your project in Eclipse.
I have a tiff image with many directories and subdirectories. I would like to navigate this tiff directory tree and import the image into a 2D array, so I can process this image. I am relatively new to java and cannot figure out how to do this. Will someone please reply to my question with a tutorial and examples of code?
Also, does anyone else find the java API documentation difficult to find, difficult to navigate, and somewhat sparse? I am trying to do this as a workaround for a processing sketch I am creating. Are there different workarounds?
Thank you.
Well i didn't even know a tiff could have directories and sub directories... But I would have a look in java File class as a start point to try to see those directories from your app. If you can see them, than you probably can parse them too.
I was wondering if anyone knew of a way that I could feed an image file to a Python, C or Java program and get back the coordinates of where a specific string appears on the image?
What you're talking about is called Optical Character Recognition, or OCR.
OCR isn't easy to implement from scratch, but there are libraries out there. OpenCV can be used for OCR.
I looked into this a bit more. It turns out that sikuli does exactly what I needed.
I am working on google appengine to create a tool for comparing image similarity.
I need to extract the pixel values of each image to perform this.
Unfortunately appengine does not support the java image libs.So I am unable to proceed.
Is there any appengine safe image library in java capable of extracting image data?
I saw some techniques in python but dont want to switch to python if I can do it in java somehow...
GAEJ has its own graphic library with fairly limited features and java.awt.image.BufferedImage is a restricted class (ie, java.awt.Image is not supported and still not present in the Jre Class White List ).
There's an open issue here, that you might want to star.
EDIT:
Somebody has patched pngj to work with InputStream.(You could use it to read a PNG pixel by pixel)
The new version of pngj now an alternative pngj-sandbox.jar that only references whitelisted classes, it should run in google-app-engine.
can https://github.com/witwall/appengine-awt help to you? i believe it willbe enough to add theis lib as dependency to the project to make BufferedImage working (but havent' tried this yet)
I'm using ImageIO.read to process uploaded image files. The code is similar to
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(image.getContents()));
I've managed to solve most of the issues, but this one has left me clueless. The uploaded image has a JCS_YCCK profile, as defined in com.sun.imageio.plugins.jpeg.JPEG, which is not supported by com.sun.imageio.plugins.jpeg.JPEGImageReader. This leads to a nice stack trace similar to:
Caused by: javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:910)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:885)
at javax.imageio.ImageIO.read(ImageIO.java:1422)
at javax.imageio.ImageIO.read(ImageIO.java:1326)
at com.example.ImageWriter.resizeEmbeddableImageInPlace(ImageWriter.java:231)
How can I process this type of JPEG using Java's ImageIO?
Update: I've tried Commons-Sanselan, indicated by an answer, but unfortunately it does not support JPEG files:
org.apache.sanselan.ImageReadException: Sanselan cannot read or write JPEG images.
at org.apache.sanselan.formats.jpeg.JpegImageParser.getBufferedImage(JpegImageParser.java:90)
at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1264)
at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1231)
One possible solution is to use the Java Advanced Imaging Image IO extensions. When properly installed, the conversion works out of the box.
The problem is that it does not play well with Maven, so I've asked Using Java Advanced Imaging with Maven. If that works out, this answer will be accepted.
I don't know for ImageIO, but you could use the Commons Sanselan library, which offers easy ways to access all sorts of images.