chai2010 / chai2010/webp

RGBA vs NRGBA

Open
#20 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
723
Forks
113
PR merge metrics
No merged PRs in 30d

Description

The webp libraries return non-premultiplied alpha values. This library wraps those values in RGBA structs which represent premultiplied values.

Everywhere `RGBA{}` is created with data returned by the webp decoder, it should be `NRGBA{}`.

e.g. this fixes one of them: https://github.com/chai2010/webp/compare/master...jamesshoebox:nrgba?expand=1

Here's a (very) simple program that illustrates the problem. If you pass in a webp with alpha, you'll see that it doesn't blend correctly with the white background.
https://gist.github.com/jamesshoebox/30ca5beada606842f98328481bf17f8d

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the decoder code for every RGBA{} constructed from values returned by the WebP libraries, using the issue's alpha-blending example to reproduce the problem first. Replace only those mismatched representations with NRGBA{} and verify that a WebP image with alpha blends correctly against a white background.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.