Page 1 of 1

Is there any command to check compression type of a file.

Posted: 2017-01-11T03:25:27-07:00
by punith8626
Hello,

Is there any command to check compression type of a file.
I have some files that are corrupted and i need to use alternative for this.How can I check whether images is looking at it without using convert command ?

Example:
I have a files with old JPEG compression type and I am not able to convert those files,Hence I need to use other convertors based on Image corrupted or not.

Could you help me on this?

Re: Is there any command to check compression type of a file.

Posted: 2017-01-11T12:02:32-07:00
by fmw42
IM can tell you the compression type if it can read the file using identify -verbose yourimage. Somewhere listed there will be the compression. Current versions of IM can tell you that more directly from %[compression]. See http://www.imagemagick.org/script/escape.php

But if IM cannot read the file due to its having an old JPEG format that libjpeg does not support, then it won't be able to tell you the compression. Perhaps you can use EXIFTOOL to tell you that information.

Re: Is there any command to check compression type of a file.

Posted: 2017-01-11T13:44:53-07:00
by GeeMack
fmw42 wrote: 2017-01-11T12:02:32-07:00Current versions of IM can tell you that more directly from %[compression]. See http://www.imagemagick.org/script/escape.php
That is how it's described under "Long Form Attribute Percent Escapes" at THIS link, but I'm using IM 7.0.4-3 on Windows 10 64, and when I run this command...

Code: Select all

magick example.jpg -format "%[compression]" info:
... it produces this warning...

Code: Select all

magick: unknown image property "%[compression]" @ warning/property.c/InterpretImageProperties/3822.
This command will still output the compression type for me...

Code: Select all

magick example.jpg -format "%[C]" info:

Re: Is there any command to check compression type of a file.

Posted: 2017-01-11T14:42:30-07:00
by fmw42
Works fine for me on (Mac OSX SnowLeopard) IM 6.9.7.3 but fails in IM 7.0.3.4. So it seems to be an issue of not getting folded over to IM 7 or being lost in some recent release.

IM 6

Code: Select all

convert logo.tif -format "%[compression]" info:
JPEG

IM 7

Code: Select all

magick logo.tif -format "%[compression]" info:
magick: unknown image property "%[compression]" @ warning/property.c/InterpretImageProperties/3822.