Twinside / Juicy.Pixels

Haskell library to load & save pictures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug on alpha channel removal?

lucch opened this issue · comments

I'm getting strange results trying to convert an RGBA8 to RGB.

Here's my code:

main :: IO ()
main = do
    Right rgba <- readImage "lion-rgba.png"
    let rgb = convertRGB8 rgba
    writePng "lion-rgb.png" rgb

And the images used.

(1) Input image ("lion-rgba.png"):

lion-rgba

(2) Resulting image ("lion-rgb.png"):
lion-rgb

Is this a problem with Juicy.Pixels, my code or the image? 😅

well convertRGB8 just strip out the alpha layer, the color value behind transparent can be anything, in that case: an extruded lion. To get what you want you should maybe special case and perform a proper alpha blending against a background of your choice (There is no helper in the library for that).