commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Føns <kfo...@gmail.com>
Subject Re: [sanselan] Writing EXIF data to JPEG
Date Thu, 08 Mar 2012 17:02:51 GMT

> Windows Explorer also likes the "XP" values (eg. EXIF_TAG_XPCOMMENT,
> EXIF_TAG_XPAUTHOR), maybe try writing those as well?
Hmm. You seem to be right that explorer likes the XP values. However, I 
can't figure out how to write to them. I can see that they are BYTE 
values, but how to convert a string into the wanted bytes?

This is the result I get:
---- IFD0 ----
XP Comment                      : 態灳牥潃浭湥t
XP Author                       : 態灳牥畁桴牯

With this code:
byte[] bytesComment = 
ExifTagConstants.EXIF_TAG_XPCOMMENT.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII, 
"KasperComment", set.byteOrder);
byte[] bytesAuthor = 
ExifTagConstants.EXIF_TAG_XPAUTHOR.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII, 
"KasperAuthor", set.byteOrder);
TiffOutputField commentField = new 
TiffOutputField(ExifTagConstants.EXIF_TAG_XPCOMMENT, 
ExifTagConstants.EXIF_TAG_XPCOMMENT.dataTypes[0], bytesComment.length, 
bytesComment);
TiffOutputField authorField = new 
TiffOutputField(ExifTagConstants.EXIF_TAG_XPAUTHOR, 
ExifTagConstants.EXIF_TAG_XPAUTHOR.dataTypes[0], bytesAuthor.length, 
bytesAuthor);
set.getOrCreateRootDirectory().add(commentField);
set.getOrCreateRootDirectory().add(authorField);

/Kasper

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


Mime
View raw message