rotating photos, updating EXIF info?

Replies:

Parents:

  • None.

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

A couple weeks ago I wrote a little script [1] to rotate photos
based on the exif orientation setting within the photos, using
jpegtran.

I got sidetracked on a small but annoying issue: once the image
has been rotated, I'd like to reset the exif 'Orientation' field
to 1. (at least, I assume that's what should be done?)

I had written another kludgy script [2] to do that, but it seems
it only works with output from my Canon G2, not other cameras :)

So I tried to use 'exif' instead, and that works well but it also
decreases the file size by ~400 bytes, which makes me nervous.
I wrote to libexif-devel about that (attached), and one of the
developers replied [3] saying it might be nothing, but wasn't sure.

Anyway, the orientation setting isn't the only thing that needs
updating once images have been rotated: height/width do as well.
(variants of photos like foo-med.jpg may also need updating:
should the exif metadata within those files refer to the original
file, or the variant itself?)

Does anyone else care about stuff like this? What do you do?
(or, what do you think should be done)

[1] http://impressive.net/software/photo/source/rotate-images
[2] http://impressive.net/software/photo/source/exifmunge

[3] mid:1057908543.577.161.camel@lutz
   apparently not archived online. Lutz wrote:

   libexif constructs EXIF data from scratch, without any unnecessary
   padding. Read the EXIF spec: The pointers to the EXIF data items are
   stored in one block, and the data items itself somewhere after the
   block. But the data items don't need to start right after the block of
   pointers, nor do they need to be packed one after another.

   This could be the 400 bytes. But it would still be interesting what is
   hidden in the 400 bytes...

--
Gerald Oskoboiny <[email protected]>
http://impressive.net/people/gerald/

--azLHFNyN32YCQGCU
Content-Type: message/rfc822
Content-Disposition: inline

Date: Thu, 10 Jul 2003 19:15:16 -0400
From: Gerald Oskoboiny <[email protected]>
To: [email protected]
Subject: file size decreases after exif --set-value?
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.28i

Hi,

Thanks for writing libexif, gexif, exif, etc; fantastic stuff!

I am trying to use 'exif' to reset the orientation value in a jpeg
file after rotating it with jpegtran, and it seems to work well
but the file size decreases by 400 bytes during the exif step.

   $ exif --ifd=0 -tag=0x0112 --set-value=1 11-23-06.jpg
   Wrote file '11-23-06.jpg.modified.jpeg'.

   $ ls -l 11-23-06*
   -rw-r--r--    1 gerald   1249462 Jul 10 18:27 11-23-06.jpg
   -rw-r--r--    1 gerald   1249066 Jul 10 18:28 11-23-06.jpg.modified.jpeg

This makes me a little nervous because I don't know what was lost.
It may be that libexif's canonical exif output is just a bit less
verbose than that used by Canon, but it would be nice to know I'm
not losing anything important.

I checked for a few obvious things that might have gone missing
(exif data, image thumbnail), but they're still there.

my test file came from a Canon G2:
http://impressive.net/people/gerald/2002/09/29/11-23-06.jpg

and I am using the latest released exif (0.6) and related libraries.

Does anyone know what those ~400 bytes might be?

Thanks,

--
Gerald Oskoboiny <[email protected]>
http://impressive.net/people/gerald/

--azLHFNyN32YCQGCU--

Re: rotating photos, updating EXIF info?

Replies:

  • None.

Parents:

On Fri, 18 Jul 2003, Gerald Oskoboiny wrote:

GO> Does anyone else care about stuff like this? What do you do?
GO> (or, what do you think should be done)

I am sad to say I let the downloading software (Canon's own for my Digital
IXUS 330 on Mac OS X) do the auto rotate.

I know this could mean loss of quality, but maybe it is smart enough to
rotate the image loss-less. Either Canon was smart enough, knowing about
the loss and knowing EXIF that they do this in their software, or they
don't care about the quality loss by rotating the image in the normal
lossy way. (People that use their cameras and don't know about it don't
care, i.e. they sell cameras to them anyway and hence it would be a waste
of money implementing it.)

As I take all my photos on Super Fine level, I have not been able to see
any quality difference between a non-rotated and auto-rotated photo. But
then I am not a professional photographer and don't really know what to
look for.

Henrik

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny