4

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

  • 9
    A little bit more detail would be nice. What are you trying to achieve? – flolilo Aug 5 '18 at 12:30
  • 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. – gdarko Aug 5 '18 at 12:33
  • 1
    null, this has nothing to do with the exiftool and is separate discussion, the "quality" still exist even after exiftool. – gdarko Aug 5 '18 at 12:46
  • 2
    @DarkoG Then why not strip the EXIF info altogether? – Michael C Aug 5 '18 at 14:53
  • 3
    As an aside, you probably want to look at Guetzli rather than messing about trying to save a few bytes of metadata. – Philip Kendall Aug 5 '18 at 16:36
34

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.

12

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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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