title: Get the Height and Width of an image
body: <p>I'm very new to Haskell so I apologise if this is too basic, or if it makes very little sense. I'm trying to read an image; I can get it to a list of pixel data with the following code:</p>
  
  <pre class="lang-hs prettyprint-override"><code>data Pixel = Pixel {
      red :: Integer,
      green :: Integer,
      blue :: Integer,
      alpha :: Integer
  } deriving (Show)
  
  getImagePixelArray :: FilePath -&gt; IO (Codec.Picture.Repa.Img RGBA)
  getImagePixelArray fp = do
      img &lt;- (either error return =&lt;&lt; readImageRGBA fp)
      return img
  
  getImagePixelData :: Codec.Picture.Repa.Img RGBA -&gt; [(Word8,Word8,Word8,Word8)]
  getImagePixelData img = R.toList (collapseColorChannel img)
  
  rawPixelToPixel :: (Word8,Word8,Word8,Word8) -&gt; Pixel
  rawPixelToPixel (r, g, b, a) = Pixel  {
      red = (toInteger r),
      green = (toInteger g),
      blue = (toInteger b),
      alpha = (toInteger a)
  }
  
  main = do
      imageData &lt;- getImagePixelArray "./images/image1.png"
      let imageRawPixels = getImagePixelData imageData
      let asPixels = Prelude.map rawPixelToPixel imageRawPixels 
      mapM print asPixels
  </code></pre>
  
  <p>I more or less follow what's going on, but my knowledge of Haskell is still limited, so when it comes to making sense of api documentation, I'm struggling a little.</p>
  
  <p>I really want to be able to parse the positions of the pixels; I understand how to do that if I know the width and height of an image, <strong>but I can't figure out how to get the width/height of an image.</strong></p>
  
  <p>I'm making my way through a Haskell course, but I'm also trying to put it to some practical use along the way to help the concepts sink in.</p>