Closed stefanpieper closed 3 months ago
This looks like a corrupt/truncated PNG image. If you trust the source of this image, please see the failOn
constructor property to relax how warnings and errors are handled.
https://sharp.pixelplumbing.com/api-constructor
// USE THIS FOR TRUSTED INPUT ONLY
sharp(input, { failOn: 'none' })...
Thanks a lot for your quick help!
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.If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of
sharp
that is not the latest, please open an issue against that package instead.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?Does this problem relate to file caching?
The default behaviour of libvips is to cache input files, which can lead to
EBUSY
orEPERM
errors on Windows. Usesharp.cache(false)
to switch this feature off.sharp.cache(false)
does not fix this problem.Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
To auto-orient pixel values use the parameter-less
rotate()
operation.To retain EXIF Orientation use
keepExif()
.[x] Using
rotate()
orkeepExif()
does not fix this problem.What are the steps to reproduce?
See attached archive with test code and data. The PNG test image is loaded and resized, then written to a buffer.
png-conversion-failure.zip
When executing the test code, this error is thrown:
What is the expected behaviour?
Process completes without error.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
See attached archive.
Please provide sample image(s) that help explain this problem
See attached archive.