Sorry about the website, I plan on fixing it with the 1.0 release.
UserComment is one of the uglier cases, as it uses that GPS string
type with a special prefix to distinguish character encodings.
Try using TagInfo.Text's encodeValue() method to convert the String to
byte[], then pass that to
new TiffOutputField(ExifTagConstants.EXIF_TAG_USER_COMMENT,
ExifTagConstants.EXIF_TAG_USER_COMMENT.fieldTypes,
bytes.length, bytes);
Thanks for the help, I can now save a usercomment and the artist field
successfully.
There is just one tiny little problem that I am now requesting some help
for.
I am able to put international characters into the artist and
usercomment field, however, the usercomment field is not shown in
Windows Explorer, but the artist is.
I have been searching the internet and found that the byteorder should
be little_endian, but that was the default case.
Is there some way to put in internation characters in the usercomment field?
Here is my current code. I altered yours a bit:
TiffOutputSet set = new
TiffOutputSet(TiffConstants.BYTE_ORDER_LITTLE_ENDIAN);
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);
Thanks on beforehand, and thanks for the help so far!
/Kasper
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]