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

Simplify alpha premultiplication, now supported by sharp #1

Closed
wants to merge 8 commits into from

Conversation

Caerbannog
Copy link
Member

Maplibre-native outputs premultiplied pixels values. The sharp library did not support it so we added code to cancel the alpha premultiplication. Note that this can only visible on raster tiles (and probably static maps).

The sharp library now supports premultiplied pixels with the right config. Let's use it: it should be faster and easier to maintain.

Feature announced here:
lovell/sharp#1599 (comment)

Feature developped here by @mnutt:
lovell/sharp#2685

Raster Before

image

Raster After (visually identical)

image

Vector for comparison (with building shadow)

image

What the problem used to look like

For reference, here is the same zone when premultiplication is not cancelled and premultiplied: true is not set.
image

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Maplibre-native outputs premultiplied pixels values. The sharp library did not
support it so we added code to cancel the alpha premultiplication.
Note that this can only visible onr raster tiles (and probably static maps).

The sharp library now supports premultiplied pixels with the right config.
Let's use it: it should be faster and easie to maintain.

Feature announced here:
lovell/sharp#1599 (comment)

Feature developped here by @mnutt:
lovell/sharp#2685

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant