JuicyPixels-3.3.9: Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance)

Safe Haskell | None
Language | Haskell2010

Codec.Picture.Bitmap

Contents

- Functions
- Accepted format in output

Description

Modules used for Bitmap file (.bmp) file loading and writing

Synopsis

- writeBitmap :: BmpEncodable pixel => FilePath -> Image pixel -> IO ()
- encodeBitmap :: BmpEncodable pixel => Image pixel -> ByteString
- encodeBitmapWithMetadata :: BmpEncodable pixel => Metadatas -> Image pixel -> ByteString
- decodeBitmap :: ByteString -> Either String DynamicImage
- decodeBitmapWithMetadata :: ByteString -> Either String (DynamicImage, Metadatas)
- decodeBitmapWithPaletteAndMetadata :: ByteString -> Either String (PalettedImage, Metadatas)
- encodeDynamicBitmap :: DynamicImage -> Either String ByteString
- encodeBitmapWithPaletteAndMetadata :: BmpEncodable pixel => Metadatas -> BmpPalette -> Image pixel -> ByteString
- writeDynamicBitmap :: FilePath -> DynamicImage -> IO (Either String Bool)
- class BmpEncodable pixel

# Functions

writeBitmap :: BmpEncodable pixel => FilePath -> Image pixel -> IO () #

Write an image in a file use the bitmap format.

encodeBitmap :: BmpEncodable pixel => Image pixel -> ByteString #

Encode an image into a bytestring in .bmp format ready to be written on disk.

encodeBitmapWithMetadata :: BmpEncodable pixel => Metadatas -> Image pixel -> ByteString #

Equivalent to `encodeBitmap` but also store the following metadatas:

- `DpiX`
- `DpiY`

decodeBitmap :: ByteString -> Either String DynamicImage #

Try to decode a bitmap image. Right now this function can output the following image:

- `ImageY8`
- `ImageRGB8`
- `ImageRGBA8`

decodeBitmapWithMetadata :: ByteString -> Either String (DynamicImage, Metadatas) #

Same as `decodeBitmap` but also extracts metadata.

decodeBitmapWithPaletteAndMetadata :: ByteString -> Either String (PalettedImage, Metadatas) #

Same as `decodeBitmap` but also extracts metadata and provide separated palette.

encodeDynamicBitmap :: DynamicImage -> Either String ByteString #

Encode a dynamic image in BMP if possible, supported images are:

- `ImageY8`
- `ImageRGB8`
- `ImageRGBA8`

encodeBitmapWithPaletteAndMetadata :: BmpEncodable pixel => Metadatas -> BmpPalette -> Image pixel -> ByteString #

Equivalent to `encodeBitmapWithPalette` but also store the following metadatas:

- `DpiX`
- `DpiY`

writeDynamicBitmap :: FilePath -> DynamicImage -> IO (Either String Bool) #

Write a dynamic image in a .bmp image file if possible. The same restriction as `encodeDynamicBitmap` apply.

# Accepted format in output

class BmpEncodable pixel #

All the instance of this class can be written as a bitmap file using this library.

Minimal complete definition

bitsPerPixel, bmpEncode, hasAlpha

#### Instances

Instances details

BmpEncodable Pixel8 # |
Instance details Defined in Codec.Picture.Bitmap Methods bitsPerPixel :: Pixel8 -> Int bmpEncode :: Image Pixel8 -> Put hasAlpha :: Image Pixel8 -> Bool defaultPalette :: Pixel8 -> BmpPalette
BmpEncodable PixelRGB8 # |
Instance details Defined in Codec.Picture.Bitmap Methods bitsPerPixel :: PixelRGB8 -> Int bmpEncode :: Image PixelRGB8 -> Put hasAlpha :: Image PixelRGB8 -> Bool defaultPalette :: PixelRGB8 -> BmpPalette
BmpEncodable PixelRGBA8 # |
Instance details Defined in Codec.Picture.Bitmap Methods bitsPerPixel :: PixelRGBA8 -> Int bmpEncode :: Image PixelRGBA8 -> Put hasAlpha :: Image PixelRGBA8 -> Bool defaultPalette :: PixelRGBA8 -> BmpPalette