batch convert to webp, without making an animation

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
vincent.tschanz
Posts: 9
Joined: 2019-10-11T01:05:00-07:00
Authentication code: 1152

batch convert to webp, without making an animation

Post by vincent.tschanz »

I want to convert multiple PNGs to WEBPs, for that I use :

Code: Select all

convert *.png -quality 90% -set filename:basename "%[basename]" "%[filename:basename]".webp
Instead of writing one webp per png, I get one webp file with all the images as an animation.

I'm pretty sure I used a similar command in the past with success.

What should I add to get individual WEBPs instead of an animation?


Here's a full test case, ImageMagick installed on Macos with Homebrew, version 7.0.9-5 Q16 x86_64 2019-11-18

Create multiple PNGs :

Code: Select all

for i in {1..9}; do convert -background black -fill grey -font impact -size 320x240 -pointsize 96 -gravity center label:$i out-$i.png; done
then attempt to convert to individual WEBPs:

Code: Select all

convert *.png -quality 90% -set filename:basename "%[basename]" "%[filename:basename]".webp
Result here is one WEBP file containing all images as an animation.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: batch convert to webp, without making an animation

Post by snibgo »

snibgo's IM pages: im.snibgo.com

vincent.tschanz
Posts: 9
Joined: 2019-10-11T01:05:00-07:00
Authentication code: 1152

Re: batch convert to webp, without making an animation

Post by vincent.tschanz »

Thanks!

when adding +adjoin I do indeed get the same number of output file as I have inputs. However the first generated images still contain all the images as an animations, the following are still images.

Is this a bug? Can someone reproduce?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: batch convert to webp, without making an animation

Post by snibgo »

For v7, I suggest you use "magick", not "convert".

With IM v7.0.8-64, using your commands with "+adjoin:

Code: Select all

for i in {1..9}; do magick -background black -fill grey -font impact -size 320x240 -pointsize 96 -gravity center label:$i out-$i.png; done

magick *.png -quality 90% -set filename:basename "%[basename]" +adjoin "%[filename:basename]".webp
Then identify the first two webp files:

Code: Select all

f:\web\im\tstwebp>%IMG7%magick identify out-1.webp
out-1.webp WEBP 320x240 320x240+0+0 8-bit sRGB 418B 0.000u 0:00.000

f:\web\im\tstwebp>%IMG7%magick identify out-2.webp
out-2.webp WEBP 320x240 320x240+0+0 8-bit sRGB 774B 0.000u 0:00.000
They both contain only one image. So I can't reproduce your problem.
snibgo's IM pages: im.snibgo.com

vincent.tschanz
Posts: 9
Joined: 2019-10-11T01:05:00-07:00
Authentication code: 1152

Re: batch convert to webp, without making an animation

Post by vincent.tschanz »

Same problem with the magick command. I guess it's a bug specific to the Homebrew version. Any idea where I should report this ?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: batch convert to webp, without making an animation

Post by snibgo »

It may be a homebrew problem, or a recent bug in IM. I suggest you post in the bugs forum https://www.imagemagick.org/discourse-s ... b4d48e080a with a link to this post. In your bug report, give IM commands that show the problem, including "identify" of the output files.
snibgo's IM pages: im.snibgo.com

vincent.tschanz
Posts: 9
Joined: 2019-10-11T01:05:00-07:00
Authentication code: 1152

Re: batch convert to webp, without making an animation

Post by vincent.tschanz »

Code: Select all

identify out-1.webp 
out-1.webp WEBP 320x240 320x240+0+0 8-bit sRGB 3366B 0.000u 0:00.000
identify out-2.webp 
out-2.webp WEBP 320x240 320x240+0+0 8-bit sRGB 460B 0.000u 0:00.000
the first one is way bigger as it's an animation

Locked