You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Franz <gr...@cip.ifi.lmu.de> on 2010/03/05 21:51:29 UTC

[SANSELAN] writing unmodified Exif causes corrupted entries?

Hi all,

I used the following code, which just reads the EXIF data from a file
and writes it back to another file without modifying it:

File src1 = new File("c:/temp/src1.jpg");
File src2 = new File("c:/temp/src2.jpg");
File dst = new File("c:/temp/out.jpg");
IImageMetadata metadata = Sanselan.getMetadata(src1);
TiffImageMetadata exif = ((JpegImageMetadata) metadata).getExif();
TiffOutputSet outputSet = exif.getOutputSet();
OutputStream os = new BufferedOutputStream(new FileOutputStream(dst));
new ExifRewriter().updateExifMetadataLossless(src2, os, outputSet);
os.close();

src1.jpg is a file with EXIF data
src2.jpg is src1.jpg without EXIF data (saved it with IrfanView and
unchecked the appropriate checkboxes in the Jpeg Save Dialog)
out.jpg should contain the EXIF information after the code was run.
Actually the EXIF data is not the same after the call.

So, is there anything wrong with the above code or with the images or is
this a bug in Sanselan?

The images, extracted and diffed Exif information can be downloaded here:
http://www.cip.ifi.lmu.de/~graff/sanselan/src1.jpg
http://www.cip.ifi.lmu.de/~graff/sanselan/src2.jpg
http://www.cip.ifi.lmu.de/~graff/sanselan/out.jpg
http://www.cip.ifi.lmu.de/~graff/sanselan/src.txt
http://www.cip.ifi.lmu.de/~graff/sanselan/out.txt
http://www.cip.ifi.lmu.de/~graff/sanselan/diff.txt

I'd be glad for any hints.
Regards
Franz

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


Re: [SANSELAN] writing unmodified Exif causes corrupted entries?

Posted by Franz <gr...@cip.ifi.lmu.de>.
Am 05.03.2010 21:51, schrieb Franz:
> I used the following code, which just reads the EXIF data from a file
> and writes it back to another file without modifying it:

Just for completeness:
I filed a bug for this and added some more information at
https://issues.apache.org/jira/browse/SANSELAN-37

Regards
franz

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