Skip to content
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

Premultiply alpha option #193

Open
capr opened this issue Dec 26, 2021 · 1 comment
Open

Premultiply alpha option #193

capr opened this issue Dec 26, 2021 · 1 comment
Labels
API Involves additions and/or changes to the API enhancement New feature or request

Comments

@capr
Copy link

capr commented Dec 26, 2021

Most graphics libs (all?) can only blend premultiplied-alpha sources. Maybe out-of-scope for libspng, but since libpng has the feature, it may be worth to add it.

EDIT: Note that most PNGs in the wild are already in premultiplied alpha but there's no bit in the file to tell if that's the case. So most (all?) of the time a premultiply pass would just be a waste of energy to satisfy the spec. AFAIR the loading time in libpng doubles because of this (tested that years ago, that might have changed).

@capr
Copy link
Author

capr commented Dec 30, 2021

Here's the code for it in case anyone needs it: https://github.com/luapower/libspng/blob/master/csrc/libspng/premultiply.c

@randy408 randy408 added API Involves additions and/or changes to the API enhancement New feature or request labels Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Involves additions and/or changes to the API enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants