Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RedPNG.hs
- import qualified Codec.Picture as CP
- import qualified Data.Vector.Storable as DV
- writeRedPNG filename (width,height) =
- let
- imageVector = DV.generate (width * 3 * height) getPixel
- getPixel i =
- case i `mod` 3 of
- 0 -> 255
- 1 -> 0
- 2 -> 0
- image = CP.Image width height imageVector
- imageRGB8 = CP.ImageRGB8 image
- in CP.writeDynamicPng filename imageRGB8
- main = writeRedPNG "red.png" (200,50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement