imgmin icon indicating copy to clipboard operation
imgmin copied to clipboard

Handle invalid min and max output quality better

Open Tenzer opened this issue 12 years ago • 3 comments

If you specify QUALITY_OUT_MAX less than QUALITY_OUT_MIN+2, imgmin will bug out with an error message such as the following:

Before quality:94 colors:93196 size:247.6kB type:TrueColor format:JPEG
imgmin: wand/magick-wand.c:181: DestroyMagickWand: Assertion `wand !=(MagickWand *) ((void *)0)' failed.
Aborted (core dumped)

It would be better if imgmin either give a decent error message, ie. referring the user to check the out min/max numbers, or if only the min or max value is given, it could automatically push the other value to be a value which makes sense, ie. 10 apart from the value specified.

Tenzer avatar Jan 01 '13 18:01 Tenzer

Can you specify the cmdline parameters in your example?

rflynn avatar Jan 11 '13 15:01 rflynn

I don't know why I didn't do that in the first place. Here's an example specifying only QUALITY_OUT_MAX:

[jeppet@silhouette test]$ imgmin --quality-out-max 71 pic.jpg pic-out.jpg
Before quality:94 colors:93196 size:247.6kB type:TrueColor format:JPEG
imgmin: wand/magick-wand.c:181: DestroyMagickWand: Assertion `wand != (MagickWand *) ((void *)0)' failed.
Aborted (core dumped)

And specifying only QUALITY_OUT_MIN:

[jeppet@silhouette test]$ imgmin --quality-out-min 94 pic.jpg pic-out.jpg
Before quality:94 colors:93196 size:247.6kB type:TrueColor format:JPEG
imgmin: wand/magick-wand.c:181: DestroyMagickWand: Assertion `wand != (MagickWand *) ((void *)0)' failed.
Aborted (core dumped)

Needless to say, you can also get the error message if you set QUALITY_OUT_MAX to a value less than 2 higher than QUALITY_OUT_MIN.

Tenzer avatar Jan 12 '13 10:01 Tenzer

+1

fraserhemp avatar Jul 08 '16 02:07 fraserhemp