You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default behaviour of libvips is to cache input files, which can lead to EBUSY or EPERM errors on Windows.
Use sharp.cache(false) to switch this feature off.
Adding sharp.cache(false) does not fix this problem.
What are the steps to reproduce?
The images look different, if you're using .toFile to save the image and stream it later or if you're directly returning the sharp object back as a response. You can test this by writing the file with fs.promises.writeFile instead of .toFile.
Creating a sharp object with composite
Saving it with .toFile and with fs.promises.writeFile
The images look different
Changing "effort" or input types (buffer or file path) did not prevent this issue. The only difference is using .toFile vs fs.promises.writeFile.
What is the expected behaviour?
There should be no differences between the two images.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
constsharpOptions: Create={width: 512,height: 512,channels: 4,background: {r: 255,g: 255,b: 255,alpha: 0},};constoverlay={input: "/your_dir/source_image.png"};// same issue if you use buffer here instead// Case: fs.promises.writeFileconstimage=sharp({create: sharpOptions}).png({effort: 4}).composite([overlay]);awaitfs.promises.writeFile("/your_dir/image_fsWriteFile.png",image);// Case: sharp.toFileawaitsharp({create: sharpOptions}).png({effort: 4}).composite([overlay]).toFile("/your_dir/image_toFile.png");
Please provide sample image(s) that help explain this problem
source_image.png
image_fsWriteFile.png
image_toFile.png
Comparison
The text was updated successfully, but these errors were encountered:
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
?I run the code sample below on my Notebook. However, it also happens on the server. I also tested this with the sharp
v0.34.0-rc.0
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.Use
sharp.cache(false)
to switch this feature off.sharp.cache(false)
does not fix this problem.What are the steps to reproduce?
The images look different, if you're using
.toFile
to save the image and stream it later or if you're directly returning the sharp object back as a response. You can test this by writing the file withfs.promises.writeFile
instead of.toFile
..toFile
and withfs.promises.writeFile
Changing "effort" or input types (buffer or file path) did not prevent this issue. The only difference is using
.toFile
vsfs.promises.writeFile
.What is the expected behaviour?
There should be no differences between the two images.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Please provide sample image(s) that help explain this problem
source_image.png
image_fsWriteFile.png
image_toFile.png
Comparison
The text was updated successfully, but these errors were encountered: