You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sanselan-dev@incubator.apache.org by Jean-Nicolas Charlier <jn...@club-internet.fr> on 2008/07/29 20:54:34 UTC
How to get the value of EXIF_TAG_XPTITLE
Hello,
I'm using the sanselan library.
I would like to get back the EXIF_TAG_XPTITLE tag in a picture.
In the following example, I set the XP title field to
"abcdefghijklmnopqrstuvwxyz" in my test picture.
Roughly, my code is :
private JpegImageMetadata _metaData;
TiffField xField;
xField =
_metaData.findEXIFValue(TiffConstants.EXIF_TAG_XPTITLE);
_logger.debug("getFieldTypeName = " +
xField.getFieldTypeName());
_logger.debug("getValueDescription = " +
xField.getValueDescription());
try {_logger.debug("getBytesLength = " +
xField.getBytesLength());} catch (ImageReadException x)
{_logger.debug("getValue : ImageReadException");}
I get back :
08-07-29 22:35:18 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
getFieldTypeName = Byte
08-07-29 22:35:18 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
getValueDescription = 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0,
104, 0, 105, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113,
0, 114, 0, 115, 0, 116, 0, 117, 0, 118, 0, 119, 0, 120, 0, 121, 0, 122...
(54)
08-07-29 22:35:23 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
getBytesLength = 54
So, it seems I have a list of bytes, representing the (extended ?) ASCII
codes separated with 0.
The fact is that the available methods allows me to get this bytes array
through an Object (using getValue) or a String (using getValueDescription).
All I want is a string corresponding to the initial
"abcdefghijklmnopqrstuvwxyz" string.
Should I code some hand-made unefficiend procedure to turn the returned
String "0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, 0,
106, 0, 107, 0." to the correct string "abcedfghijklmnopqrstuvwxyz" ?
Can someone help ?
Regards,
JNC
Re: How to get the value of EXIF_TAG_XPTITLE
Posted by Charles Matthew Chen <ch...@gmail.com>.
Hi Jean-Nicolas,
Thanks for the question. I've created a Jira issue.
https://issues.apache.org/jira/browse/SANSELAN-7
Would you please be so kind as to attach the image in question
there? Please make sure to indicate whether or not you are
contributing the image to the project's library of images.
Thanks,
Charles
On Tue, Jul 29, 2008 at 10:54 PM, Jean-Nicolas Charlier
<jn...@club-internet.fr> wrote:
> Hello,
>
>
>
> I'm using the sanselan library.
>
> I would like to get back the EXIF_TAG_XPTITLE tag in a picture.
>
> In the following example, I set the XP title field to
> "abcdefghijklmnopqrstuvwxyz" in my test picture.
>
>
>
> Roughly, my code is :
>
>
>
> private JpegImageMetadata _metaData;
>
>
>
> TiffField xField;
>
>
>
> xField =
> _metaData.findEXIFValue(TiffConstants.EXIF_TAG_XPTITLE);
>
>
>
> _logger.debug("getFieldTypeName = " +
> xField.getFieldTypeName());
>
> _logger.debug("getValueDescription = " +
> xField.getValueDescription());
>
> try {_logger.debug("getBytesLength = " +
> xField.getBytesLength());} catch (ImageReadException x)
> {_logger.debug("getValue : ImageReadException");}
>
>
>
> I get back :
>
>
>
>
>
> 08-07-29 22:35:18 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
> getFieldTypeName = Byte
>
> 08-07-29 22:35:18 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
> getValueDescription = 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0,
> 104, 0, 105, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113,
> 0, 114, 0, 115, 0, 116, 0, 117, 0, 118, 0, 119, 0, 120, 0, 121, 0, 122...
> (54)
>
> 08-07-29 22:35:23 (JpegNodes.JpegFile,getTitleFromExif) DEBUG :
> getBytesLength = 54
>
>
>
> So, it seems I have a list of bytes, representing the (extended ?) ASCII
> codes separated with 0.
>
> The fact is that the available methods allows me to get this bytes array
> through an Object (using getValue) or a String (using getValueDescription).
>
> All I want is a string corresponding to the initial
> "abcdefghijklmnopqrstuvwxyz" string.
>
>
>
> Should I code some hand-made unefficiend procedure to turn the returned
> String "0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, 0,
> 106, 0, 107, 0." to the correct string "abcedfghijklmnopqrstuvwxyz" ?
>
> Can someone help ?
>
>
>
>
>
> Regards,
>
>
>
> JNC
>
>