Tag reading/writing bugs and new ExifInterface class
----------------------------------------------------
Key: SANSELAN-51
URL: https://issues.apache.org/jira/browse/SANSELAN-51
Project: Commons Sanselan
Issue Type: Bug
Affects Versions: 0.94-incubator
Environment: Android on Linux,
Windows 7
Reporter: Tonio Barmadosa
Hi,
Currently, I'm using Sanselan for Android. (
http://code.google.com/p/sanselanandroid/ ) because Android exif reading and
writing is a bit buggy. I've implemented the ExifInterface class in Sanselan
based on this (
http://developer.android.com/reference/android/media/ExifInterface.html ), and
tested it with several jpeg images and various exif and gps tags. It seems to
work on Android, but when I tried to integrate it with the main Sanselan
project, I got some exceptions.
1. String type writing and reading
* In TiffOutputField.create(), when a String value is passed, sometimes the
ASCII field type is not identified correctly, whereas in the Android project,
it is. I've
merged the two projects and now ASCII fields are always identified.
1.a Exif string reading and writing
* For instance, the IMAGE_DESCRIPTION field is written correctly in the
Android project, but in the main Sanselan it writes empty spaces.
1.b GPS string reading and writing
* For GPS tags, it reads them fine first, then writes them fine. But on
second try, it cannot read them properly. With a program called ExifTool,
however, the tags
are parsable from the file
2. Tag Constant Values
* I've corrected some of the TagInfo constants in ExifTagConstants and
GpsTagConstants based on this reference (
http://www.awaresystems.be/imaging/tiff/tifftags.html ). For
example, GPSImgDirection, GPSAltitude, GPSAltitudeRef ... etc, length was
-1 in Sanselan, but in the reference, it is 1.
3. ShortFieldType
* In addition, when a short is passed to a ShortFieldType, it throws an
exception, saying it expects an integer? I'm not really sure what that means.
Anyways, I'm not very familiar with the EXIF specification, so I did not change
the way values are written on the byte level. Nevertheless, I've tested
ExifInterface with some other common tags and it does work with those. For the
problematic cases, you can find the tests in ExifInterfaceTest.java, which also
shows example usage of ExifInterface. For example:
ExifInterface exifInterface = new ExifInterface(filePath);
double oldAltitude =
exifInterface.getAttributeDouble(GPSTagConstants.GPS_TAG_GPS_ALTITUDE, 0);
double newAltitude = 132.4;
exifInterface.setAttribute(GPSTagConstants.GPS_TAG_GPS_ALTITUDE, newAltitude);
exifInterface.saveAttributes();
double newestAltitude =
exifInterface.getAttributeDouble(GPSTagConstants.GPS_TAG_GPS_ALTITUDE, 0);
Cheers
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira