I want to write XPKeywords in a Jpeg Image. Till now I am using Sansaleen java api for writing Exif tags in Jpeg images. I am able to write most of the tags like subject, co
Got it working:
public static TiffOutputField getTiffOutputFieldKeyword(
TiffOutputSet outputSet, String metaDataToChange) {
TiffOutputField imageHistoryPre = outputSet
.findField(TiffConstants.EXIF_TAG_XPKEYWORDS);
if (imageHistoryPre != null) {
outputSet.removeField(TiffConstants.EXIF_TAG_XPKEYWORDS);
}
TiffOutputField tiffOutputField = new TiffOutputField(
TiffConstants.EXIF_TAG_XPKEYWORDS,
TiffFieldTypeConstants.FIELD_TYPE_BYTE,
metaDataToChange.getBytes("UTF-16").length, metaDataToChange.getBytes("UTF-16"));
return tiffOutputField;
}
Just use length of Bytes in "UTF-16" and then write. Also, Make sure you trim the characters to not include any spaces. Also, please give a try by separating string with Semicolon(;) as By default Windows take semicolon separated keywords.