4
\$\begingroup\$

I noticed some photos missing "quality" information in their metadata using ImageMagick's identify command

identify -verbose image.jpg

How can one remove this info?

This is one example

enter image description here

\$\endgroup\$
8
  • 9
    \$\begingroup\$ A little bit more detail would be nice. What are you trying to achieve? \$\endgroup\$
    – flolilo
    Commented Aug 5, 2018 at 12:30
  • \$\begingroup\$ I am trying to understand how this works. My ultimate goal is to strip as much as possible metadata from the image to reduce its size. For me every byte is important as long as the image quality is intact. \$\endgroup\$
    – gdarko
    Commented Aug 5, 2018 at 12:33
  • 1
    \$\begingroup\$ null, this has nothing to do with the exiftool and is separate discussion, the "quality" still exist even after exiftool. \$\endgroup\$
    – gdarko
    Commented Aug 5, 2018 at 12:46
  • 2
    \$\begingroup\$ @DarkoG Then why not strip the EXIF info altogether? \$\endgroup\$
    – Michael C
    Commented Aug 5, 2018 at 14:53
  • 3
    \$\begingroup\$ As an aside, you probably want to look at Guetzli rather than messing about trying to save a few bytes of metadata. \$\endgroup\$
    – Philip Kendall
    Commented Aug 5, 2018 at 16:36

3 Answers 3

34
\$\begingroup\$

In short: there is no reason to care about this value and it its presence does not make your file larger.

identify -verbose filename(s)

only displays the quality if the image uses the standard quantization matrix. You can use nonstandard matrix (-define jpeg:q-table=...) to make this value disappear.

The quality will be, however still displayed when the (better) command

identify -format 'the quality of %f is %Q' filename(s)

is used (better for displaying the quality that is, it only looks for this value instead of performing the detailed analysis of the image, which makes it much faster than "identify -verbose")

The thing is, you can't really remove the quality value, similarly how you can't "remove" the image width or height. It is the inherent attribute of the JPEG image and is calculated by ImageMagick from the JPEG quantization tables contained in the file.

It does not have, however, any standarized meaning. The value displayed by ImageMagick corresponds to the Independent JPEG Group's libjpeg quality setting (also used in GIMP and many others), other software packages can have their own incompatible quality measures. In such nonstandard case, ImageMagick can only estimate the quality, by looking what standard quality table is similar to the actual one. Use the "-debug All" will (among others) display the following:

Quality: 85 (exact)

or

Quality: 85 (approximate)

For some reason, "-verbose" only displays the value when it is exact, while "-format %Q" will always display the quality, even if it is just approximate.

\$\endgroup\$
0
12
\$\begingroup\$

This isn't metadata that can be stripped. It's an analysis of the compression calculated from the quantization tables. When it's comes back unknown, the jpeg was compressed using a program that isn't known to identify.

See this SuperUser answer.

Edit: Upvotes for @szulat answer, much more detailed than mine.

\$\endgroup\$
1
\$\begingroup\$

As stated by szulat and StarGeek, "quality" is not a property that can be removed from a JPEG image.

If your purpose is to remove metadata, you can use any of the following commands:

exiftool -All= image.jpg
jpegoptim -s image.jpg

Some image sharing sites automatically remove metadata.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.