dlemstra / magick-wasm

The WASM library for ImageMagick
Apache License 2.0
515 stars 34 forks source link

Getting strange Error when trying convert GIF to APNG #162

Closed salivity closed 2 weeks ago

salivity commented 2 months ago

magick-wasm version

^0.0.26

Description

Unable to do a direct conversion from GIF to APNG which should be efficient using this superior format.

Steps to Reproduce

            ```
            let quality = typeof options.quality !== "undefined" ? options.quality : 75;

            ImageMagick.read(new Uint8Array(array_buffer), async (img) => {

                img.quality = quality; 
                img.format = MagickFormat.Apng;

                img.settings.setDefine(MagickFormat.Apng, "delay", 100);
                img.settings.setDefine(MagickFormat.Apng, "loop", 0);

                if(typeof width !== "undefined" && typeof height !== "undefined"){
                    img.resize(width, height);
                }

                img.write((data) => {
                   self.postMessage({type: "complete", array: data, extension: "apng", mimetype: "image/apng"})
                }, )

            }).then(() => {

            }).catch((error) => {
                self.postMessage({type: "error", message: error.message})
            })


Returns the following Error from write();

FailedToExecuteCommand `'ffmpeg' -nostdin -loglevel error -i '/tmp/magick-HdhKcrR_dR72Zw4PskXq_uKw5qNLfKFg%d.webp' -plays 0 '/tmp/magick-qwJqhHIO9BHhnZIPmnHwGG9wYnojAjFC.APNG'' (-1) @ error/delegate.c/ExternalDelegateCommand/522

### Images

_No response_
dlemstra commented 2 months ago

You are getting this error message because the output format is apng and that requires ffmpeg that is not available in the WASM implementation.