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

Gif image resizing does not work as expected #2347

Closed
xdays opened this issue Aug 31, 2020 · 2 comments
Closed

Gif image resizing does not work as expected #2347

xdays opened this issue Aug 31, 2020 · 2 comments
Labels

Comments

@xdays
Copy link

xdays commented Aug 31, 2020

The original gif is:

But what I get is:

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

root@24d4f802e1f7:/tmp# vips -v
vips-8.10.0-Sat Jul 18 13:45:47 UTC 2020
root@24d4f802e1f7:/tmp# npm ls sharp
demo@1.0.0 /tmp
`-- sharp@0.26.0

What are the steps to reproduce?

const sharp = require('sharp');

sharp('t.gif', {
  animated: true
}).resize(160).toFile('o.gif', (err, info) => {
  console.log(err, info)
});

and I can resize with pyvips, so I'm sure libvips works:

import pyvips
thumb = pyvips.Image.thumbnail("t.gif[n=-1]", 160)
thumb.write_to_file("x.gif")

What is the output of running npx envinfo --binaries --system?

npx: installed 1 in 3.094s

  System:
    OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 6.01 GB / 7.78 GB
    Container: Yes
    Shell: 4.4.12 - /bin/bash
  Binaries:
    Node: 12.18.3 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.6 - /usr/local/bin/npm
@xdays xdays added the triage label Aug 31, 2020
@lovell
Copy link
Owner

lovell commented Aug 31, 2020

Hi, you'll need to manually set pageHeight - see https://sharp.pixelplumbing.com/api-output#gif

There's a future possible enhancement at #2275 to make this easier.

@lovell lovell added question and removed triage labels Aug 31, 2020
@xdays
Copy link
Author

xdays commented Sep 1, 2020

Thanks @lovell , it works now.

@xdays xdays closed this as completed Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants