Reading and writing arrays as uncompressed 24 and 32 bit Windows BMP files.
- readImageFromBMP :: FilePath -> IO (Either Error (Array DIM3 Word8))
- readComponentsFromBMP :: FilePath -> IO (Either Error (Array DIM2 Word8, Array DIM2 Word8, Array DIM2 Word8))
- readComponentsListFromBMP :: FilePath -> IO (Either Error [Array DIM2 Word8])
- readMatrixFromGreyscaleBMP :: FilePath -> IO (Either Error (Array DIM2 Double))
- writeImageToBMP :: FilePath -> Array DIM3 Word8 -> IO ()
- writeComponentsToBMP :: FilePath -> Array DIM2 Word8 -> Array DIM2 Word8 -> Array DIM2 Word8 -> IO ()
- writeComponentsListToBMP :: FilePath -> [Array DIM2 Word8] -> IO ()
- writeMatrixToGreyscaleBMP :: forall a. (Num a, Elt a, Fractional a, RealFrac a) => FilePath -> Array DIM2 a -> IO ()
Documentation
readImageFromBMP :: FilePath -> IO (Either Error (Array DIM3 Word8))Source
Read a RGBA image from a BMP file.
In the result, the higher two dimensions are the height and width,
and the lower indexes the RGBA component of each pixel.
If the BMP read has no alpha channel then alpha of the resulting pixels is set to 255.
If anything goes wrong when loading the file then Error
.
readComponentsFromBMP :: FilePath -> IO (Either Error (Array DIM2 Word8, Array DIM2 Word8, Array DIM2 Word8))Source
Read RGB components from a BMP file.
Returns arrays of red, green and blue components, all with the same extent.
If anything goes wrong when loading the file then then Error
.
readComponentsListFromBMP :: FilePath -> IO (Either Error [Array DIM2 Word8])Source
Like readComponentsFromBMP
, but return the components as a list.
writeImageToBMP :: FilePath -> Array DIM3 Word8 -> IO ()Source
Write a RGBA image to a BMP file.
The higher two dimensions are the height and width of the image.
The lowest dimension must have size 4, corresponding to the RGBA components
of each pixel, else error
.
writeComponentsToBMP :: FilePath -> Array DIM2 Word8 -> Array DIM2 Word8 -> Array DIM2 Word8 -> IO ()Source
Write RGB components to a BMP file.
All arrays must have the same extent, else error
.
writeComponentsListToBMP :: FilePath -> [Array DIM2 Word8] -> IO ()Source
Like writeComponentsToBMP
but take the components as a list.
The list must have 3 arrays, for the red, green blue components
respectively, else error
.