commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damjan Jovanovic <>
Subject Re: [sanselan] Writing EXIF data to JPEG
Date Wed, 07 Mar 2012 05:37:10 GMT
On Wed, Mar 7, 2012 at 12:46 AM, Kasper F√łns <> wrote:
> Hi Sanselan.
> I have a hard time finding out how to use Sanselan.
> Suppose I have some JPEG picture which I want to add some attributes to.
> If for example I want to add some user comment or date I try this:
> TiffOutputSet outputSet = new TiffOutputSet();
> TiffOutputField dateTaken =
> TiffOutputField.create(TiffConstants.EXIF_TAG_CREATE_DATE,
> outputSet.byteOrder, "2003:03:29 17:47:50");
> TiffOutputField comment =
> TiffOutputField.create(TiffConstants.EXIF_TAG_IMAGE_DESCRIPTION,
> outputSet.byteOrder, "This is a test!");
> However, both of these fails on "unexpected data type".
> If I am not supposed to give a String, then what I am supposed to supply?
> I hope you can help with these, probably noobish questions.
> /Kasper

That TiffOutputField.create() was a horribly broken API that I've
eliminated in the latest SVN, and replaced with a new, beautiful, type
safe, code completable, byte order independent
TiffOutputDirectory.add() API.

I recommend you use the latest SVN, or wait for the 1.0 release in a
few weeks. If you really must use version 0.97, I think the only way
to get strings to work is to convert the string to bytes with
getBytes(), null-terminate those yourself, then pass them to the
low-level constructor "new TiffOutputField(...)".


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message