imgmin
imgmin copied to clipboard
Handle invalid min and max output quality better
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.
Can you specify the cmdline parameters in your example?
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.
+1