No effect from WebP's near-lossless
option in ImageMagick convert
#6204
-
ImageMagick version7.1.1.5-1 Operating system, version and so onArch Linux DescriptionThe ImageMagick docs for WebP note that there should be a "near-lossless" option that maps to cwebp's $ for q in 20 40 60 80 90; do magick convert data/10568-103447.pdf\[0\] -define webp:near-lossless=$q /tmp/10568-103447-near-lossless-q${q}.webp; done
$ ls -l /tmp/10568-103447-near-lossless-q*
-rw-r--r-- 1 aorth aorth 37470 Mar 29 14:23 /tmp/10568-103447-near-lossless-q20.webp
-rw-r--r-- 1 aorth aorth 37470 Mar 29 14:23 /tmp/10568-103447-near-lossless-q40.webp
-rw-r--r-- 1 aorth aorth 37470 Mar 29 14:23 /tmp/10568-103447-near-lossless-q60.webp
-rw-r--r-- 1 aorth aorth 37470 Mar 29 14:23 /tmp/10568-103447-near-lossless-q80.webp
-rw-r--r-- 1 aorth aorth 37470 Mar 29 14:23 /tmp/10568-103447-near-lossless-q90.webp The file sizes are all the same. I tried again with cwepb (from libwebp 1.3.0) and it works as expected: $ magick convert data/10568-103447.pdf\[0\] -quality 100 img/10568-103447.pdf.jpg
$ for q in 20 40 60 80 90; do cwebp -near_lossless $q img/10568-103447.pdf.jpg -o /tmp/10568-103447-cwebp-near-lossless-q${q}.webp; done
$ ls -l /tmp/10568-103447-cwebp-near-lossless-q*
-rw-r--r-- 1 aorth aorth 115394 Mar 29 14:26 /tmp/10568-103447-cwebp-near-lossless-q20.webp
-rw-r--r-- 1 aorth aorth 122056 Mar 29 14:26 /tmp/10568-103447-cwebp-near-lossless-q40.webp
-rw-r--r-- 1 aorth aorth 118732 Mar 29 14:26 /tmp/10568-103447-cwebp-near-lossless-q60.webp
-rw-r--r-- 1 aorth aorth 140514 Mar 29 14:26 /tmp/10568-103447-cwebp-near-lossless-q80.webp
-rw-r--r-- 1 aorth aorth 140514 Mar 29 14:26 /tmp/10568-103447-cwebp-near-lossless-q90.webp I see a related question about this from a few years ago, but I'm not sure which ImageMagick version shipped with support for this. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
What version of webp is installed with Imagemagick
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the problem report. We can reproduce it and will have a patch to fix it in the GIT main branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://imagemagick.org/archive/beta/ by sometime tomorrow. Use |
Beta Was this translation helpful? Give feedback.
-
Thank you for the patch, @urban-warrior. From reading the if (image->quality != UndefinedCompressionQuality)
{
configure.quality=(float) image->quality;
#if WEBP_ENCODER_ABI_VERSION >= 0x020e
configure.near_lossless=(float) image->quality;
#endif
} Thanks |
Beta Was this translation helpful? Give feedback.
-
The theory is that the near lossless parameter is a no-op unless lossless compression is enabled. Our testing confirms our conjecture. |
Beta Was this translation helpful? Give feedback.
Thanks for the problem report. We can reproduce it and will have a patch to fix it in the GIT main branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://imagemagick.org/archive/beta/ by sometime tomorrow.
Use
-define webp:lossless=1 -quality 90
, for example.