jpegtran is NOT lossless with metadata (Exif data, etc.) by default

Bug #381140 reported by Richard Laager
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
libjpeg6b (Debian)
Fix Released
Unknown
libjpeg6b (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

From the man page:
        NAME
               jpegtran - lossless transformation of JPEG files
        ...
               ... But by the same token, jpegtran cannot perform lossy operations
               such as changing the image quality.
        ...
               -copy comments
                      Copy only comment markers. This setting copies comments from
                      the source file, but discards any other inessential data.

               -copy all
                      Copy all extra markers. This setting preserves miscellaneous
                      markers found in the source file, such as Exif data, JFIF thumb‐
                      nails and Photoshop settings. In some files these extra markers
                      can be sizable.

                      The default behavior is -copy comments.

As you can see, jpegtran explicitly claims to be lossless. It even
further claims it "cannot perform lossy operations". (I realize now
that's only talking about image data.) But, the default for extra marker
copying is "-copy comment", which drops Exif data. This means that every
picture I've rotated with jpegtran has lost its Exif data. Luckily, I
probably don't need it that bad, but I was using this tool explicitly
because it's supposedly lossless.

I realize that the man page is clear about the default value of -copy,
but who reads an entire man page to find the one option that makes the
description under NAME untrue?

I propose these possible solutions, in order of preference:
     1. Add a new argument to copy that behaves like -copy all, but
        *updates* the JFIF and/or EXIF thumbnails after transforming
        the image. Make this option the default.
     2. Add a new argument to copy that behaves like -copy all, but
        *drops* (does not copy) the JFIF thumbnails. Make this option
        the default.
     3. Make -copy all the default.
     4. Add a new argument to copy that behaves like -copy comments, but
        also copies exif markers. Make this option the default. The
        first patch here might be useful, though I'm not sure if it also
        copies comments:
        https://bugzilla.redhat.com/show_bug.cgi?id=106060
     5. Add an asterisk after lossless at the top of the man page and
        then add a note under it such as, '* The only extra markers
        copied by default are comments. This means certain data (Exif
        data, JFIF thumbnails, Photoshop settings, etc.) will be lost.
        To copy all extra markers, see the "-copy all" argument.'

Changed in libjpeg6b (Debian):
status: Unknown → New
Changed in libjpeg6b (Ubuntu):
status: New → Confirmed
Revision history for this message
Mechanical snail (replicator-snail) wrote :

I agree that the default of dropping EXIF metadata is not sensible.

Comment on proposals (1) and (2): Probably thumbnails /should/ be dropped by default if the -optimize option is specified.

Note that the version in Ubuntu Lucid is 6b (almost 13 years old!); the most recent version from http://www.ijg.org/ is 8a (this year, 2010).

summary: - jpegtran is NOT lossless with Exif data by default
+ jpegtran is NOT lossless with metadata (Exif data, etc.) by default
Changed in libjpeg6b (Debian):
status: New → Fix Committed
Changed in libjpeg6b (Debian):
status: Fix Committed → Fix Released
Richard Laager (rlaager)
Changed in libjpeg6b (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.