Red Hat Bugzilla – Bug 106060
Add support for EXIF in jpegtran and rdjpgcom tools
Last modified: 2007-04-18 12:58:04 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20030131
Description of problem:
Current versions of jpegtran and rdjpgcom tools of libjpeg are not aware of the
EXIF kind of JPEG files.
In jpegtran, even using the '-copy all' does not treat EXIF files correctly. The
1. A JFIF marker is always added to the output file, which is incompatible with
EXIF (EXIF requires that EXIF marker be first extra marker, but JFIF has the
2. Upon a geometric transformation (e.g., 90 deg rotation) the image dimension
fields in the EXIF marker are not updated.
3. Upon a geometric transformation the EXIF orientation flag is not reset.
As EXIF files become increasingly popular as they are produced by nearly all
digital cameras, this issues create a bunch of problems with dealing with EXIF
Also rdjpgcom should probably report the EXIF orientation when in verbose mode.
Version-Release number of selected component (if applicable):
Created attachment 94878 [details]
Patch for basic EXIF support in jpegtran
This patch adds the requested features to jpegtran. It basically does:
1. Recognizes EXIF files as such and does not add an incompatible JFIF marker.
2. Upon a geometric transformation it adjusts the dimensions in the EXIF marker
to match the JPEG image dimensions.
3. Upon a geometric transformation it resets the EXIF orientation flag so that
the resulting JPEG image is considered to be in the upright position already.
4. Add the option '-copy exif' that allows to recover an EXIF file to which a
JFIF marker was incorrectly added.
The patch does not affect the library code, only the jpegtran code and
therefore it should not pose any compatibility problems.
Created attachment 94879 [details]
Patch to implement the requested rdjpeg features
This patch adds basic EXIF support to rdjpgcom: in -verbose mode it prints the
EXIF orientation, if any is found.
This, in conjunction to the patched jpegtran, allows to write scripts that
automatically orient images based on the EXIF orientation field (used by some
digital cameras for this very same purpose).
The patch does not modify any library code, so it should not present any
I have also reported these patches to the IJG at firstname.lastname@example.org
I believe that these features would best be done by packaging jhead for Fedora.