tag:blogger.com,1999:blog-7025390077222270096.post7745293719776486105..comments2023-12-19T13:37:03.195+00:00Comments on Code from an English Coffee Drinker: PNG KeywordsMarkhttp://www.blogger.com/profile/02418527698793489162noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7025390077222270096.post-55542675123080477022013-06-22T09:04:11.822+01:002013-06-22T09:04:11.822+01:00Right I've looked into this and I think I know...Right I've looked into this and I think I know what you are seeing. You will find the the title/author (or whatever keywords you added) appear under both the PNG specific javax_imageio_png_1.0 section and the generic javax_imageio_1.0. This is entirely normal. The first section shows what was encoded in the actual image file, while the second is Java's generic metadata format and is generated (in part) from the PNG specific stuff.Markhttps://www.blogger.com/profile/02418527698793489162noreply@blogger.comtag:blogger.com,1999:blog-7025390077222270096.post-83910768848926609302013-06-20T22:51:27.066+01:002013-06-20T22:51:27.066+01:00Excellent article. When I printed the metadata fro...Excellent article. When I printed the metadata from your example, I got the following. I see that the inserted keywords occur two times (twice, as you say). Is this as intended? Or, am I inserting two times or just printing two time incorrectly?<br /><br />Format name: javax_imageio_png_1.0<br /><br /> <br /> <br /> <br /> <br /> <br /><br />Format name: javax_imageio_1.0<br /><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /><br /><br />This is the code I am using to print:<br /><br /> File file = new File(fileName);<br /> ImageInputStream iis = ImageIO.createImageInputStream(file);<br /><br /> if (iis == null)<br /> {<br /> System.out.printf("Unable to Open File: %s\n", fileName);<br /> return;<br /><br /> }<br /> else<br /> {<br /> Iterator readers = ImageIO.getImageReaders(iis);<br /> if (readers.hasNext())<br /> {<br /><br /> // pick the first available ImageReader<br /> ImageReader reader = readers.next();<br /><br /> // attach source to the reader<br /> reader.setInput(iis, true);<br /><br /> // read metadata of first image<br /> IIOMetadata metadata = reader.getImageMetadata(0);<br /><br /> String[] names = metadata.getMetadataFormatNames();<br /> int length = names.length;<br /> for (int i = 0; i < length; i++)<br /> {<br /> System.out.println("Format name: " + names[i]);<br /> displayMetadata(metadata.getAsTree(names[i]));<br /> }<br /> }Unknownhttps://www.blogger.com/profile/03275104404753174769noreply@blogger.comtag:blogger.com,1999:blog-7025390077222270096.post-92217477549097175362013-06-17T13:19:15.427+01:002013-06-17T13:19:15.427+01:00Thanks for posting! Very helpful!Thanks for posting! Very helpful!Unknownhttps://www.blogger.com/profile/03275104404753174769noreply@blogger.com