3

Generally I use PHP, and ImageMagick, but as far as I can tell it seems the ImageMagick group refuse to implement the ability to create/understand animated PNG files?

What tooling can I implement to take a dozen JPEG files and create an animated PNG out of them? I'd prefer to have a PHP api, but I can branch out into another language if required!

Thanks

Codemonkey
  • 4,455
  • 5
  • 44
  • 76

1 Answers1

5

As of ImageMagick 7.0.10-31, Animated PNG is supported.

magick -delay 100 -loop 0 frame1.png frame2.png APNG:myanimation.png

parameters:
-delay 100 specifies a duration of 100 centiseconds (aka one second) per frame before moving on to the next frame.
-loop 0 tells the animation to repeat forever.
APNG:___.png specifies the output should be animated png.

(thanks to @fmw42 for improvements)

note: on MacOS Ventura, this seems to require ffmpeg as well.

orion elenzil
  • 4,484
  • 3
  • 37
  • 49
  • 2
    Your syntax is not actually correct. You specify it properly as `magick -delay 100 -loop 0 frame1.png frame2.png APNG:myanimatedpng.png` Note the APNG: preface and that it is actually a sub function of png. Also in Imagemagick 7, use magick, not magick convert. The changelog lists it as added 7.0.10.31 – fmw42 Oct 25 '21 at 23:32
  • 1
    thank you for these. updated. in my own work I realized "apng:foo.png" was better, but forgot to come back and edit my answer. – orion elenzil Oct 26 '21 at 17:31
  • 2
    I did give you an up vote for your answer anyway already as you properly noted that Imagemagick can do that. – fmw42 Oct 26 '21 at 18:24