-
-
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
composite operation create a gray outline with the latest 0.30.2 #3118
Comments
These kind of fringe effects around edges usually relate to premultiplication. Commit c620025 in v0.30.2 switched from libvips' Does this only occur for |
do you think I should transfer this issue to https://github.com/libvips/libvips and reference the change in libvips/libvips#1301 ? |
Thanks for confirming, if you're able to reproduce using |
thank you, here is my results using output of --vips-config
I don't reproduce the issue using |
fwiw I got the same results when sharp use the globally available libvip instead of the prebuilt binaries
|
Thanks for the all the extra examples, I can reproduce this locally with sharp, but I've yet to try to reproduce with vips at the command line. If sharp premultiplies both images before compositing and sets I think we're seeing this due to libvips only premultiplying one of the images when compositing, which is usually the "lower" image, but with the Possibly the calculation for the @jcupitt When you get a mo, please can you check the current |
Hi @lovell, this is an odd one. I tried a small test program #!/usr/bin/python3
import sys
import pyvips
image = pyvips.Image.new_from_file(sys.argv[1])
tile = pyvips.Image.new_from_file(sys.argv[2])
background = tile \
.replicate(1 + image.width / tile.width,
1 + image.height / tile.height) \
.crop(0, 0, image.width, image.height)
over = background.composite(image, "over")
dest_over = image.composite(background, "dest-over")
diff = (over - dest_over).abs().max()
print(f"maximum difference = {diff}") With git master libvips and with 8.12 I see:
So I think I would patch sharp to save the argument images to composite just before calling it, probably as If the input images are wrong I suppose sharp might have a stray premultiply still. If they are OK and the output is wrong, we have a reproducer for a libvips bug. |
Thanks John, I think I've found the problem, there was a extra unpremultiply taking place in sharp after composite that affects some of the dest-* blend modes. Rather annoyingly the unit tests did pick this up at the time but I incorrectly assumed the "new" behaviour was more accurate. c620025#diff-7a6322e019754e2e5f843a65aa8cfb3635d77a757b88ef4c6a9450a022e5678f |
I've reverted the test fixtures to their v0.30.1 state, as well as removing the unpremultiply operation when compositing, in commit 23033e2 This will be in v0.30.3, thanks for reporting. |
v0.30.3 now available. |
yes I messed up my test files... and was testing with a wrong input, it works fine, thank you again |
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?
take a transparent png,
apply a composite with tiles to the background,
output to jpeg or webp,
a gray outline is visble (obvious on white images like attached)
inputFile
inputTile
example code 1:
example code 2:
output with 0.30.2
output with 0.30.1
The text was updated successfully, but these errors were encountered: