Operations that introduce non-opaque background make unnecessary, implicit cast to double #3465
Closed
3 tasks done
Labels
Milestone
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 is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
Hi Lovell,
while using your excellent library, we hit a problem of which I hope you can give some hints on the cause.
We try to do image manipulation in several steps, converting a sharp to a buffer and re-reading it, since we need to apply transformations in arbitrary order. To speed up converting to a buffer, we want to use uncompressed TIFF format. As soon as we add an alpha channel to the image, however, conversion of a previously written buffer back to a sharp fails.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
This is a simplified code snippet to illustrate the issue:
What is the expected behaviour?
With the second sharp(buffer), an error is thrown by libvips:
It seems that all components (R, G, B, and Alpha) are represented as 8-byte floats each. If no alpha is included, the conversion and re-reading works just fine with R, G, and B being represented by uchar. The issue does not appear with raw format but that one cannot handle animated images, unfortunately (#3189).
Knowing too little about JavaScript and C++, I failed to find my way through the code to see the root cause of the issue.
Do you have a hint maybe or know a way around it?
Thanks,
Stefan
The text was updated successfully, but these errors were encountered: