On Thu, Mar 8, 2012 at 2:45 PM, Kasper Føns <kfo...@gmail.com> wrote: > >> 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
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 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org