Menu

#410 TIFF unexpectedly uses JPG compression

v1.0_(example)
closed-rejected
None
5
2017-01-28
2017-01-28
Matthijs
No

I expected "gm convert filename.jpg filename.tiff" to basically decompress the JPG and store the result in a TIFF file. Instead, it recompresses to a smaller TIFF file using JPG compression.

This differs from the imagemagick version, which creates an uncompressed TIFF.

Example:

gm convert AFC.JPG gm_AFC.tiff
convert AFC.JPG im_AFC.tiff

Results in two TIFF files, the gm version is 1,2MB, the im version is 24MB.

Sourcefile: https://github.com/TimJDFletcher/IMG_7082

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2017-01-28
    • status: open --> closed-rejected
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2017-01-28

    This behavior is intentional, applies to some other formats as well, and is long-standing behavior originating in ImageMagick. Compression (and other aspects) are preserved if possible. Use 'gm convert in.jpg -compress none out.tiff' in order to avoid any compression. This formula will work with modern ImageMagick as well and assures the desired result.

     
  • Matthijs

    Matthijs - 2017-01-28

    Thanks for your reply. In this case I wonder why there is a recompression, instead of copying the JPG-data into the TIFF container. The original file is 2,9MB, the resulting TIFF is 1,2MB.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2017-01-28

    We are using libtiff to encode the TIFF. Regardless, JPEG encoded in TIFF is not generally the same as JPEG in a JFIF wrapper (normal JPEG file). TIFF stores data as several strips or tiles, which are individually compressed. Recent GraphicsMagick requests YCbCr encoding of JPEG in TIFF (rather than RGB) which results in a much smaller size, but normal JPEG files are also usually YCbCr encoded. Even when GraphicsMagick "converts" from an input JPEG file to an output JPEG file without any transformations requested, the JPEG is re-compressed but if the same paramers are used the result is similar to the input. There is not a standard for JPEG compression parameters so IJG JPEG (which GraphicsMagick uses) compresses differently than software like Photoshop.

     

Log in to post a comment.