Closed finscn closed 2 years ago
In the options , I've tried set false or true to palette
, compressionLevel = 0 to 9 , no effect to save full color.
Please can you provide input images and the complete, standalone code (as text, not an image) that allows someone else to reproduce this.
npm install
node main.js
see the the difference between input/3-bug-image.png
and the part of output.png
I know composite by a batch of images
is better than composite image one by one
.
But I think the composite().toBuffer() should be lossless compression
.
So even I composite one by one , the result should as same as composite by a batch of images
.
The input image 3-bug-image.png
has an alpha channel and a "background" (matte) of #BDBDBD00
. When you view the image on its own, e.g. in a browser, the background colour will appear under the image. When you composite, the background colour is ignored as you are providing the background to composite over.
If you'd like to include the background colour of an image when compositing, you'll need to composite that image over a solid image of the background colour first.
At the moment sharp doesn't expose the background colour of a PNG (this is the bKGD
chunk) although it would make a good addition.
@lovell , but if I composite all images in an array (just run composite() one time ) , not one by one, there is no any issue.
So maybe there is some misunderstanding
@lovell , There is a new test-case : test-sharp-bug.zip
you could compare the two js-files.
Please can you try with the latest v0.30.3 release, as there have been a number of recent improvements to the speed and accuracy of composite
.
I hope this information helped. Please feel free to re-open with more details if further assistance is required.
Are you using the latest version? Is the version currently in use as reported by
npm ls sharp
the same as the latest version as reported bynpm view sharp dist-tags.latest
?yes , I've tried from 0.27 to 0.28.3.
What are the steps to reproduce? Use sharp output png whatever how to set
options
.What is the expected behaviour? the output file should not lost the colors.
original image:
output image:
see the red spots in the sail. There are many pixel lost color
What is the output of running
npx envinfo --binaries --system
? System: OS: macOS 11.4 CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz Memory: 109.24 MB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.22.1/bin/yarn npm: 7.15.0 - ~/.nvm/versions/node/v12.22.1/bin/npm