I wouldn't count on Windows Explorer to give you the right values.
Rather check it against exiftool
(www.sno.phy.queensu.ca/~phil/exiftool/):
exiftool -a -g1 -u image.tiff

Windows Explorer also likes the "XP" values (eg. EXIF_TAG_XPCOMMENT,
EXIF_TAG_XPAUTHOR), maybe try writing those as well?

Damjan

Sorry for asking so many questions :( I hope it is okay.

Hmm. It does not seem like the XP values work. They do not show correctly.

Anyways, I tried using the code I sent you without special characters:
byte[] bytesComment = ExifTagConstants.EXIF_TAG_USER_COMMENT.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII, "KasperComment", set.byteOrder); byte[] bytesAuthor = TiffTagConstants.TIFF_TAG_ARTIST.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII, "KasperAuthor", set.byteOrder); TiffOutputField commentField = new TiffOutputField(ExifTagConstants.EXIF_TAG_USER_COMMENT, ExifTagConstants.EXIF_TAG_USER_COMMENT.dataTypes[0], bytesComment.length, bytesComment); TiffOutputField authorField = new TiffOutputField(TiffTagConstants.TIFF_TAG_ARTIST, TiffTagConstants.TIFF_TAG_ARTIST.dataTypes[0], bytesAuthor.length, bytesAuthor);
set.getOrCreateExifDirectory().add(commentField);
set.getOrCreateRootDirectory().add(authorField);

Then the exif tools shows (and so do windows explorer):
---- IFD0 ----
Artist                          : KasperAuthor
---- ExifIFD ----
User Comment                    : KasperComment
---- JFIF ----
JFIF Version                    : 1.01

However, trying the same, but adding an å to KasperComment and KasperAuthor gives the following:
---- IFD0 ----
Artist                          : KasperAuthorå
---- ExifIFD ----
User Comment                    : 䭡獰敲䍯浭敮瓃
---- JFIF ----
JFIF Version                    : 1.01

It seems the UserComment has been destroyed. Now it is suddenly chinese characters!?
Windows explorer shows the artist but not the usercomment.

Is this something to do with ExifDirectory vs RootDirectory?

/Kasper

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to