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

I cannot redirect a webp animated of different height and width #2737

Closed
GladistonXD opened this issue May 31, 2021 · 4 comments
Closed

I cannot redirect a webp animated of different height and width #2737

GladistonXD opened this issue May 31, 2021 · 4 comments
Labels

Comments

@GladistonXD
Copy link

"archive webp: dimension 400x500"

sharp('archive.webp', {animated: true})
	.resize(400)
	.webp({pageHeight: 400})

output: dimension 400x2100...

I can only get a satisfactory result with a file of equal dimensions, is it possible to get around this?

@lovell
Copy link
Owner

lovell commented Jun 1, 2021

Please can you provide a sample input image to help explain your question.

@GladistonXD
Copy link
Author

Yes exemple this webp animated 498x463

@lovell
Copy link
Owner

lovell commented Jun 1, 2021

Thanks, this doesn't have quite the same dimensions as the original question, but here's how you might resize this to 400x372:

const { pages } = await sharp("archive 498x463.webp").metadata();
await sharp("archive 498x463.webp", { animated: true })
  .resize({ width: 400, height: pages * 372 })
  .webp({ pageHeight: 372 })
  .toFile("out.webp")

Please subscribe to #2275 for a future possible enhancement that relates to this.

@GladistonXD
Copy link
Author

GladistonXD commented Jun 1, 2021

Yes above was a small example, thanks this solved the problem, I'll sign the enhancement congratulations on the library

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