Codec.Picture.ColorQuant

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

Safe Haskell | None
Language | Haskell2010

Codec.Picture.ColorQuant

Description

This module provide some color quantisation algorithm in order to help in the creation of paletted images. The most important function is `palettize` which will make everything to create a nice color indexed image with its palette.

Synopsis

- palettize :: PaletteOptions -> Image PixelRGB8 -> (Image Pixel8, Palette)
- palettizeWithAlpha :: [(GifDelay, Image PixelRGBA8)] -> GifDisposalMethod -> [GifFrame]
- defaultPaletteOptions :: PaletteOptions
- data PaletteCreationMethod
  - = MedianMeanCut
  - | Uniform
- data PaletteOptions = PaletteOptions {
  - paletteCreationMethod :: PaletteCreationMethod
  - enableImageDithering :: Bool
  - paletteColorCount :: Int
  }

# Documentation

palettize :: PaletteOptions -> Image PixelRGB8 -> (Image Pixel8, Palette) #

Reduces an image to a color palette according to `PaletteOptions` and returns the indices image along with its `Palette`.

palettizeWithAlpha :: [(GifDelay, Image PixelRGBA8)] -> GifDisposalMethod -> [GifFrame] #

Converts RGBA image to the array of GifFame's to use in encodeComplexGifImage

defaultPaletteOptions :: PaletteOptions #

Default palette option, which aim at the best quality and maximum possible colors (256)

data PaletteCreationMethod #

Define which palette creation method is used.

Constructors

MedianMeanCut | MedianMeanCut method, provide the best results (visualy) at the cost of increased calculations.
Uniform | Very fast algorithm (one pass), doesn't provide good looking results.

data PaletteOptions #

To specify how the palette will be created.

Constructors

PaletteOptions |
Fields paletteCreationMethod :: PaletteCreationMethod Algorithm used to find the palette enableImageDithering :: Bool Do we want to apply the dithering to the image. Enabling it often reduce compression ratio but enhance the perceived quality of the final image. paletteColorCount :: Int Maximum number of color we want in the palette