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

Incorect behaviour of extractComponent #14

Closed
Twinside opened this issue Jun 25, 2012 · 0 comments
Closed

Incorect behaviour of extractComponent #14

Twinside opened this issue Jun 25, 2012 · 0 comments

Comments

@Twinside
Copy link
Owner

Reported by Joel Bo Svensson

Hi.

Today I tried to add a few image functions to a library of mine and decided to use your juicy pixels
(Which seems great). But I do not get the behaviour I expected from extractComponent. Ill illustrate in code:

loadBMP_DBG fp = 
    withFile fp ReadMode $ \handle -> do 
    bs <- BS.hGetContents handle 
    case decodeBitmap bs of 
        (Left str) -> error str 
        (Right (ImageRGB8 img)) ->
            do 
            let red   = extractComponent 0 img
                green = extractComponent 1 img
                blue  = extractComponent 2 img 
                (Image _ _ vr)    = red 
                (Image _ _ vg)    = green
                (Image _ _ vb)    = blue 
            putStrLn $ show vr
            putStrLn $ show vg 
            putStrLn $ show vb

The picture I use is attached, it is just an image filled with the same color (10,20,30). So I expected
that show vr would yield [10,10,10,...
and vg [20,20,20....
and vb [30,30,30...

instead i get [10,30,20,10,30,20.. for vb
and [20,10,30,20,10,30... for vg
and [30,20,10,30,20,10... for vb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant