I just started learning Haskell, so I am likely missing something very trivial. I am attempting to generate images using Haskell Image Processing. I am adapting the code from sample snippets from the docs. My code is as follows.
{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import Prelude as P
import Graphics.Image as I
getPixel :: (Int, Int) -> Pixel RGB Word8
getPixel (i, j) = PixelRGB (fromIntegral i) (fromIntegral j) (fromIntegral (i + j))
getImage :: (Int, Int) -> Image VS RGB Word8
getImage (w, h) = makeImageR VS (w, h) getPixel
main :: IO ()
main = writeImage "image.png" image
where image = getImage (1024, 1024)
when I try to build it, I get the following
• No instance for (Writable (Image VS RGB Word8) OutputFormat)
arising from a use of ‘writeImage’
• In the expression: writeImage "image.png" image
In an equation for ‘main’:
main
= writeImage "image.png" image
where
image = getImage (1024, 1024)
Cannot seem to figure out what I am doing wrong.