Codec.Picture.Gif

Contents

Description

Module implementing GIF decoding.

Synopsis

Transform a raw gif image to an image, without modifying the pixels. This function can output the following images:

• ImageRGB8
• ImageRGBA8

Transform a raw gif image to an image, without modifying the pixels. This function can output the following images:

• ImageRGB8
• ImageRGBA8

Metadatas include Width & Height information.

Return the gif image with metadata and palette. The palette is only returned for the first image of an animation and has no transparency.

Transform a raw gif to a list of images, representing all the images of an animation.

Extract a list of frame delays from a raw gif.

Writing

type GifDelay = Int #

Delay to wait before showing the next Gif image. The delay is expressed in 100th of seconds.

data GifLooping #

Help to control the behaviour of GIF animation looping.

Constructors

 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

Encode a greyscale image to a bytestring.

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

Encode a gif animation to a bytestring.

• Every image must have the same size
• Every palette must have between one and 256 colors.

Write a greyscale in a gif file on the disk.

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 ()) #

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.