commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tiersene <tiers...@gmail.com>
Subject Re: [sanselan] Writing EXIF data to JPEG
Date Tue, 31 Jul 2012 23:45:35 GMT
Hi

@Kasper did you get things working??

I'm trying to write an android application that lets me read and write user
comments in JPEG files.
I'm using sanselan since there is no user comments field in the Android
ExifInterface API. The issue is that the USER_COMMENT and the XPCOMMENT
remain unchanged.

Here is part of my code

IImageMetadata meta = null;
meta = Sanselan.getMetadata(jpegImageFile);
JpegImageMetadata jpegMetadata = (JpegImageMetadata) meta;
TiffOutputSet set = new
TiffOutputSet(TiffConstants.BYTE_ORDER_LITTLE_ENDIAN);
    	
byte[] bytesXPComment =
    
ExifTagConstants.EXIF_TAG_XPCOMMENT.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII,
    			"My xp comments", set.byteOrder);
TiffOutputField xpcommentField = new
    			TiffOutputField(ExifTagConstants.EXIF_TAG_XPCOMMENT,
    			ExifTagConstants.EXIF_TAG_XPCOMMENT.dataTypes[0],
bytesXPComment.length,
    			bytesXPComment);
set.getOrCreateRootDirectory().add(xpcommentField);
    		
byte[] bytesUserComment =
   
ExifTagConstants.EXIF_TAG_USER_COMMENT.encodeValue(TiffFieldTypeConstants.FIELD_TYPE_ASCII,
    			"My user comments", set.byteOrder);
TiffOutputField usercommentField = new
    			TiffOutputField(ExifTagConstants.EXIF_TAG_USER_COMMENT,
    			ExifTagConstants.EXIF_TAG_USER_COMMENT.dataTypes[0],
bytesUserComment.length,
    			bytesUserComment);
set.getOrCreateRootDirectory().add(usercommentField);

Thanking you in advance. 



--
View this message in context: http://apache-commons.680414.n4.nabble.com/sanselan-Writing-EXIF-data-to-JPEG-tp4451598p4637450.html
Sent from the Commons - User mailing list archive at Nabble.com.

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


Mime
View raw message