Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image.getProperty() and JPEG files




On 20 Apr 2007, at 16:28, Kerry Shetline wrote:

Can anyone tell me how one creates or modifies a JPEG so that Image.getProperty() will actually find properties which can be gotten?

I've tried adding a comment to a JPEG via GraphicConverter. I can see the comment in a hex dump of the file, but Java seems blissfully unaware of the comment being there. Just in case "comment" wasn't the right property name to use, I looked at my Image object in a debugger and I can see a member variable named "properties" -- it's nothing but an empty Hashtable.

I've used a MediaTracker to make sure my image is fully loaded -- and since at the same point in the code I can paint the image into a BufferedImage, I have confirmation the image is fully loaded and rendered. The image byte data clearly contains my comment text, so I know I'm loading the correct commented image.

The Java API docs talk about using a property named "comment" "to store an optional comment which can be presented to the application as a description of the image, its source, or its author". The Swing ImageIcon class tries to use the "comment" property to get a description of an ImageIcon. The idea of using one of these "comment" properties seems to be out there -- but a lot of Googling has failed to turn up any mention of how the #$&*@!!! (yeah, I'm getting a bit frustrated at this point) you're supposed to put a comment into an image in the first place.

I don't think the AWT JEPG decoder handles comments. If you look at the JPEG Decoder source code in the JDK , there seems to be no mention of setting properties at all.


You might have better luck using javax.imageio.ImageIO:

http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/metadata/doc- files/jpeg_metadata.html

Jerry

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Image.getProperty() and JPEG files (From: Kerry Shetline <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.