Home > javax imageio iioexception error > javax.imageio.iioexception error reading png image data

Javax.imageio.iioexception Error Reading Png Image Data

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Javax.ImageIO.IIOException for PNG image Data up vote 1 down vote favorite I am implementing a server in java which recieves images from an android application. basically it is recieving image from android emulator but not from android device. This all process of recieving an image from android emulator or android device is done on localhost. here is my code of the server. public class Server { private static ServerSocket serverSocket; private static Socket clientSocket; private static InputStreamReader inputStreamReader; private static BufferedReader bufferedReader; private static String message; private static byte[] image; public static void main(String[] args) throws UnknownHostException, IOException { try { serverSocket = new ServerSocket(4000); // Server socket } catch (IOException e) { System.out.println("Could not listen on port: 4000"); } System.out.println("Server started. Listening to the port 4000"); while (true) { clientSocket = serverSocket.accept(); // accept the client connection inputStreamReader = new InputStreamReader(clientSocket.getInputStream()); bufferedReader = new BufferedReader(inputStreamReader); // get the client message DataInputStream inputFromClient = new DataInputStream(clientSocket.getInputStream()); int count = inputFromClient.available(); System.out.println(count); image = new byte[count]; inputFromClient.readFully(image); final BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(image)); ImageIO.write(bufferedImage, "jpg", new File("image.jpg")); } } Exception Exception in threa

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it http://stackoverflow.com/questions/29506088/javax-imageio-iioexception-for-png-image-data only takes a minute: Sign up javax.imageio.IIOException: Error reading PNG image up vote 0 down vote favorite after getting the byte array when I am passing the byte array inside BufferedImage using BufferedImage bImageFromConvert = ImageIO.read(in); It is showing the error: javax.imageio.IIOException: Error reading PNG image data at com.sun.imageio.plugins.png.PNGImageReader.readImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) what might http://stackoverflow.com/questions/16089352/javax-imageio-iioexception-error-reading-png-image be the reason behind this? java share|improve this question edited Apr 18 '13 at 17:27 Ezhil V 818310 asked Apr 18 '13 at 17:19 user2295281 63 whats the value of in when you do BufferedImage bImageFromConvert = ImageIO.read(in);? –Mr D Apr 18 '13 at 17:26 There should be a wrapped exception in your output with more helpful information than "Error". –Sir RotN Apr 19 '13 at 14:37 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Browse other questions tagged java or ask your own question. asked 3 years ago viewed 612 times Blog Stack Overflow Podcast #91 - Can You Stump Nick Craver? Related 2283Read/convert an In

details. Win a copy of Penetration Testing Basics this week in the Security forum! Post https://coderanch.com/t/514477/java/java/reading-PNG-image-ImageIO-API Reply Bookmark Topic Watch Topic New Topic programming forums https://samebug.io/exceptions/179894/javax.imageio.IIOException/error-reading-png-image-data-- Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: Other JSE/JEE APIs Problem while reading PNG image through ImageIO API Amrut Chaudhary Greenhorn Posts: 3 posted 5 years javax.imageio.iioexception error ago Hi, I am using the commons-fileupload API to upload images. I first write the image to disk and then load it via ImageIO.read(new FileInputStream("my.png")) it works fine for some PNG images but for some PNG image it gives me error like. javax.imageio.IIOException: Error reading PNG image data at javax.imageio.iioexception error reading com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1291) at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1560) at javax.imageio.ImageIO.read(ImageIO.java:1422) at javax.imageio.ImageIO.read(ImageIO.java:1326) at com.asite.imageio.ImageIOTest.readImage(ImageIOTest.java:45) at com.asite.imageio.ImageIOTest.main(ImageIOTest.java:27) Caused by: java.io.EOFException: Unexpected end of ZLIB input stream at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read1(BufferedInputStream.java:258) at java.io.BufferedInputStream.read(BufferedInputStream.java:317) at java.io.DataInputStream.readFully(DataInputStream.java:178) at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1075) at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1179) at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1284) ... 5 more Here is the code which i wrote to read image BufferedImage image =ImageIO.read(new FileInputStream("abc.png")); int width = image.getWidth(); int height = image.getHeight(); System.out.println("width : "+width+"\nheight : "+height); Lester Burnham Rancher Posts: 1337 posted 5 years ago Firstly, have you made sure that after the upload, the files are bit-for-bit identical copies of the original files? Secondly, be aware that web apps do not work well (or at all) with relative file paths (like "abc.png"); you should switch to using absolute paths (maybe by including the web app context root). Post Reply Bookmark Topic Watch Topic New Topic Similar Threads Serialization/Deserialization

help others javax.imageio.IIOException: Error reading PNG image data at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1308) Stack Overflow | user2021346 | 4 years ago 0 mark ImageIO.read -> Error reading PNG image data Stack Overflow | 4 years ago | user2021346 javax.imageio.IIOException: Error reading PNG image data at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1308) find similars Java RT 0 0 mark Error while reading PNG image dimensions Stack Overflow | 2 years ago | rickygrimes javax.imageio.IIOException: I/O error reading PNG header! find similars Java RT 0 0 mark Urgent - Getting error in Eclipse for drag/drop of check box to Layout xml Google Groups | 5 years ago | Dinesh javax.imageio.IIOException: Error reading PNG metadata find similars Java RT Android Platform com.android.layoutlib 0 Speed up your debug routine! Automated exception search integrated into your IDE Test Samebug Integration for IntelliJ IDEA 0 mark I attached a png image, got an error while I open this bug on browser. 2015-12-24 09:20:32,153 file-attachment-store:thread-2 ERROR gushengyuan 560x67x1 i0brg2 10.9.0.11,10.14.1.85 /browse/NGA-933 [core.util.thumbnail.Thumber] Unable to create thumbnail image for id 15702 javax.imageio.IIOException: Error reading PNG metadata at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:769) at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1229) at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1577) at com.atlassian.core.util.thumbnail.Thumber.scaleImage(Thumber.java:231) at com.atlassian.core.util.thumbnail.Thumber.createThumbnail(Thumber.java:291) at com.atlassian.core.util.thumbnail.Thu

 

Related content

javax.imageio.iioexception error reading png metadata

Javax imageio iioexception Error Reading Png Metadata p After attaching an image to a JIRA issue the image doesn't seem to be successfully attached If you click on Cancel or refresh the page you will not be able to view the issue any longer It just keeps trying to load but remains a blank page Following appears in theatlassian-jira log - - file-attachment-store thread- ERROR admin x x t ctls plugins servlet streams core util thumbnail Thumber Unable to create thumbnail image for id javax imageio IIOException Error reading PNG metadata at com sun imageio plugins png PNGImageReader readMetadata PNGImageReader