-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Resizing then extracting Webp images past 16,383 now fails from sharp 0.30.x #3262
Comments
sharp v0.30.x now takes greater advantage of libwebp's scale-on-load feature, however it doesn't appear to allow upscaling beyond the maximum dimensions for WebP. What we're seeing is an "encoding" error when decoding, which is maybe a bug in libwebp, or at least a (lack of) feature. https://developers.google.com/speed/webp/docs/api#advanced_decoding_api I guess we could avoid any upscaling via libwebp (we can downscale still, as that provides a good speedup) by checking the value of Lines 224 to 232 in b10d8f8
Happy to accept a PR, if you're able. |
Yes, this sounds like the right approach, especially as the upsampling performance of libwebp is much worse than libvips. Did you see that sharp supports tile-based output to generate deep zoom image pyramids? I'm not sure it quite meets your needs, but the lowest level of tiles might be close to what you're doing. https://sharp.pixelplumbing.com/api-output#tile |
Ok ill have a go at that when i get some spare time!
This is basically what we are doing right now, not sure how detail you want 😁 We (LINZ) are a govt agency are distributing TBs of imagery to end users (https://basemaps.linz.govt.nz) we create cloud optimised geotiffs which are basically geo referenced pyramids with GDAL, then use sharp/libvips to join our various imagery sets to together base don user requirements, eg highest resolution imagery vs most recent imagery. All the source code is open here https://github.com/linz/basemaps |
If you're only chopping huge images into tile pyramids, then sharp should be a lot quicker and lighter than gdal. You'll need to use gdal if you are applying a projection, of course. |
Everything is georeferenced, all the tile pyramids also have to align to a TileMatrixSet, We use both a local New Zealand projection (EPSG:2193) and a global projection (EPSG:3857) so GDAL does a ton of heavy lifting for the pyramid creation. |
v0.30.7 now available, thank you @blacha for both reporting and fixing this. |
Awesome thanks for all the hard work @lovell ! We have deployed the new version and it fixes our issue 🎉 |
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.node -e "require('sharp')"
completes without error.Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.What are the steps to reproduce?
Example https://github.com/blacha/sharp-resize
What is the expected behaviour?
In sharp 0.29.x I can resize a webp image to basically any size and then extract a region from the enlarged image without any issue. In sharp 0.30.x this now fails with
Error: webp: bad image dimensions
I see some work was done in libvips recently to improve image resizing especially with SVGs, is there a easy way to go back to the old resizing method?
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Example https://github.com/blacha/sharp-resize
Please provide sample image(s) that help explain this problem
Sample image in repo.
The text was updated successfully, but these errors were encountered: