Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save GIFs - gifsave_buffer not found #13

Open
mikebarlow opened this issue Sep 16, 2022 · 7 comments
Open

Can't save GIFs - gifsave_buffer not found #13

mikebarlow opened this issue Sep 16, 2022 · 7 comments

Comments

@mikebarlow
Copy link

mikebarlow commented Sep 16, 2022

Hey, with the latest updates it appears that we can no longer save gif file types.

I'm getting the following error when I try to perform actions and save a gif image.

{ "errorType": "Error", "errorMessage": "VipsOperation: class \"gifsave_buffer\" not found\n", "trace": [ "Error: VipsOperation: class \"gifsave_buffer\" not found", "" ] }

I'm fairly sure this has occurred with the latest V3.0.0 release. I went back to an old version of the layer in AWS that was created using the 2.0.2release and GIFs are working again but HEIC/HEIF files are broken and don't save due to the version of SharpJS in use, so rolling back isn't an option.

This is our implementation of Sharp at the moment, I've simplified this somewhat however as we have a ton of different calculations in place for different file types and such

// srcFile is the Body buffer from S3 GetObject call
let image = sharp(srcFile, {animated: true});

image = await image.resize({
    width: newSize.width,
    height: newSize.height,
    fit: resizeType,
    background: {r: 255, g: 255, b: 255, alpha: 1},
});

processedBuffer = await image.toBuffer();

// processedBuffer is then passed to S3.putObject

Appreciate this may be SharpJS issue rather than an issue with the layer, however given this layer is the one loading in the packages for the different libs, I assumed it may be an issue here rather than Sharp itself.

@zoellner
Copy link
Owner

#12 was meant to add GIF support
@xtrinch can you comment on this?

@xtrinch
Copy link
Contributor

xtrinch commented Sep 16, 2022

Gifs work for me, perhaps the usage differs. Here's mine:

    buffer = await Sharp(bodyContents, { animated: true })
        .rotate()
        .resize({
            width,
            height,
            fit: (format.fit || mode) as keyof FitEnum,
        }) // maximally double the largest dimension
        .toFormat("webp")
        .webp({
            quality: format.quality || 80,
        })
        .toBuffer();

This basically creates an animated webp out of a gif (I have not tried gif to gif however)

@mikebarlow
Copy link
Author

Yeah, it seems the same aside from the output. We are wanting to keep the same file type at the moment so in our instance it is trying to save as a GIF.

I have tried both animated GIFs and a static GIF too with my code and I'm getting the same error. I have a fork of this repo and currently have a build running where I've bumped SharpJS to see if that fixes anything.

@mikebarlow
Copy link
Author

Sadly that didn't work, still getting the same error when saving as gif. I have also tried bumping the libvips version at the top of the Makefile to, what appears to be their latest version, 8.13.1 and sadly still nothing.

@zoellner
Copy link
Owner

In that case I'd suggest to try your pipeline with the vanilla SharpJS version to check if it works there and if not open an issue with them.

@mikebarlow
Copy link
Author

Yeah, looks like that will be my next step. @xtrinch are you able to confirm if your build works if you do change the output format to gif?

@xtrinch
Copy link
Contributor

xtrinch commented Sep 19, 2022

Are you sure you're not installing sharp from npm separately? (i.e. double check that sharp is not in your package.json dependency). Gif output should work out of the box with prebuilt binaries too, and your error sounds like there's a mismatch in vips version for sharp (each sharp release needs a specific vips version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants