Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module implementing GIF decoding.
- decodeGif :: ByteString -> Either String DynamicImage
- decodeGifImages :: ByteString -> Either String [DynamicImage]
- getDelaysGifImages :: ByteString -> Either String [GifDelay]
- type GifDelay = Int
- data GifLooping
- encodeGifImage :: Image Pixel8 -> ByteString
- encodeGifImageWithPalette :: Image Pixel8 -> Palette -> Either String ByteString
- encodeGifImages :: GifLooping -> [(Palette, GifDelay, Image Pixel8)] -> Either String ByteString
- writeGifImage :: FilePath -> Image Pixel8 -> IO ()
- writeGifImageWithPalette :: FilePath -> Image Pixel8 -> Palette -> Either String (IO ())
- writeGifImages :: FilePath -> GifLooping -> [(Palette, GifDelay, Image Pixel8)] -> Either String (IO ())
- greyPalette :: Palette
Reading
decodeGif :: ByteString -> Either String DynamicImage Source
Transform a raw gif image to an image, witout modifying the pixels. This function can output the following pixel types :
- PixelRGB8
- PixelRGBA8
decodeGifImages :: ByteString -> Either String [DynamicImage] Source
Transform a raw gif to a list of images, representing all the images of an animation.
getDelaysGifImages :: ByteString -> Either String [GifDelay] Source
Extract a list of frame delays from a raw gif.
Writing
Delay to wait before showing the next Gif image. The delay is expressed in 100th of seconds.
data GifLooping Source
Help to control the behaviour of GIF animation looping.
LoopingNever | The animation will stop once the end is reached |
LoopingForever | The animation will restart once the end is reached |
LoopingRepeat Word16 | The animation will repeat n times before stoping |
encodeGifImage :: Image Pixel8 -> ByteString Source
Encode a greyscale image to a bytestring.
encodeGifImageWithPalette :: Image Pixel8 -> Palette -> Either String ByteString Source
Encode an image with a given palette. Can return errors if the palette is ill-formed.
- A palette must have between 1 and 256 colors
encodeGifImages :: GifLooping -> [(Palette, GifDelay, Image Pixel8)] -> Either String ByteString Source
Encode a gif animation to a bytestring.
- Every image must have the same size
- Every palette must have between one and 256 colors.
writeGifImage :: FilePath -> Image Pixel8 -> IO () Source
Write a greyscale in a gif file on the disk.
writeGifImageWithPalette :: FilePath -> Image Pixel8 -> Palette -> Either String (IO ()) Source
Write a gif image with a palette to a file.
- A palette must have between 1 and 256 colors
writeGifImages :: FilePath -> GifLooping -> [(Palette, GifDelay, Image Pixel8)] -> Either String (IO ()) Source
Write a list of images as a gif animation in a file.
- Every image must have the same size
- Every palette must have between one and 256 colors.
Default palette to produce greyscale images.