-
Notifications
You must be signed in to change notification settings - Fork 145
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
Docs should say whether Rgba<T> is premultiplied or not #443
Comments
This library neither applies pre-multiplication nor removes it. We'll return the pixel values as they're stored in the file so it is up to you to know whether your image files come pre-multiplied or not. The main image crate however does contain some amount of code for applying blending which I believe assumes that the image is stored non-premultiplied |
But is there a convention for the DynamicImage's the decoders in image-rs give? |
In practice, However, there's some challenges to making that a convention everywhere:
*I think the PNG spec says images are always supposed to be non-premultiplied but people sometimes ignore that. |
Do we have any formats that actually output premultiplied? (not counting non-standard PNG extensions or hacks) I think we can document they're always uncorrelated. Stuffing other data into lossless formats is not our problem (the alpha could be a heightmap or rgb could be normals). |
This issue is slightly confusing because it is opened against the
Yes. The TIFF format supports both premultiplied and non-premultiplied alpha. Not sure precisely how |
I couldn't find the string
premul
in the source code except for the algorithm in the blend filter 😅Are images decoded with alpha premultiplied or not? It doesn't matter for my application; it can handle either format.
The text was updated successfully, but these errors were encountered: