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

Safe Haskell | None
Language | Haskell2010

Codec.Picture.Tga

Description

Module implementing function to read and write Targa (*.tga) files.

Synopsis

- decodeTga :: ByteString -> Either String DynamicImage
- decodeTgaWithMetadata :: ByteString -> Either String (DynamicImage, Metadatas)
- decodeTgaWithPaletteAndMetadata :: ByteString -> Either String (PalettedImage, Metadatas)
- class TgaSaveable a
- encodeTga :: TgaSaveable px => Image px -> ByteString
- writeTga :: TgaSaveable pixel => FilePath -> Image pixel -> IO ()

# Documentation

decodeTga :: ByteString -> Either String DynamicImage #

Transform a raw tga image to an image, without modifying the underlying pixel type.

This function can output the following images:

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

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

Equivalent to decodeTga but also provide metadata

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

Equivalent to decodeTga but with metdata and palette if any

class TgaSaveable a #

This typeclass determine if a pixel can be saved in the TGA format.

Minimal complete definition

tgaDataOfImage, tgaPixelDepthOfImage, tgaTypeOfImage

Instances

TgaSaveable PixelRGBA8 # |
Methods tgaDataOfImage :: Image PixelRGBA8 -> ByteString tgaPixelDepthOfImage :: Image PixelRGBA8 -> Word8 tgaTypeOfImage :: Image PixelRGBA8 -> TgaImageType
TgaSaveable PixelRGB8 # |
Methods tgaDataOfImage :: Image PixelRGB8 -> ByteString tgaPixelDepthOfImage :: Image PixelRGB8 -> Word8 tgaTypeOfImage :: Image PixelRGB8 -> TgaImageType
TgaSaveable Pixel8 # |
Methods tgaDataOfImage :: Image Pixel8 -> ByteString tgaPixelDepthOfImage :: Image Pixel8 -> Word8 tgaTypeOfImage :: Image Pixel8 -> TgaImageType

encodeTga :: TgaSaveable px => Image px -> ByteString #

Transform a compatible image to a raw bytestring representing a Targa file.

writeTga :: TgaSaveable pixel => FilePath -> Image pixel -> IO () #

Helper function to directly write an image a tga on disk.