Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
getPixels :: Image -> IO [[Color]]
getPixels image =
do (width, height) <- imageSize image
pixelsPointer <- withImagePtr image $
\gdi -> #{peek gdImage, tpixels} gdi
columnPixelArray <- peekArray height pixelsPointer
mapM (\a -> peekArray width a) columnPixelArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.