Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance) https://github.com/Twinside/Juicy.Pixels

Version on this page:3.3.3
LTS Haskell 13.22:3.3.3
Stackage Nightly 2019-05-23:3.3.3
Latest on Hackage:3.3.3

See all snapshots JuicyPixels appears in

BSD-3-Clause licensed by Vincent Berthoux
Maintained by vincent.berthoux@gmail.com

Module documentation for 3.3.3

There are no documented modules for this package.

Juicy logo



This library provides saving & loading of different picture formats for the Haskell language. The aim of the library is to be as lightweight as possible, you ask it to load an image, and it’ll dump you a big Vector full of juicy pixels. Or squared pixels, or whatever, as long as they’re unboxed.


The library documentation can be accessed on Hackage


For the user of:


  • PNG (.png)

    • Reading

      • 1,2,4,8 bits loading, Grayscale, 24bits, 24 bits with alpha, interleaved & filtered (fully compliant with the standard, tested against png suite).
    • Writing

      • 8bits RGB (non interleaved)
      • 8bits RGBA (non interleaved)
      • 8bits greyscale (non interleaved)
      • 16bits greyscale (non interleaved)
      • 16bits RGB (non interleaved)
      • 16bits RGBA (non interleaved)
      • 8bits RGB paletted image
      • 8bits RGBA paletted image
    • Metadata (reading/writing)

      • in a tEXT chunk: ‘Title’, ‘Description’, ‘Author’, ‘Copyright’, ‘Software’, ‘Comment’, ‘Disclaimer’, ‘Source’, ‘Warning’
      • any other tEXT chunk.
      • in a gAMA field : ‘Gamma’
      • DPI information in a pHYs chunk.
  • Bitmap (.bmp)

    • Reading

      • 16 or 32 bit RGBA images
      • 16, 24, 32 bit RGB images
      • 1, 4, or 8 bit (greyscale & paletted) images
      • RLE encoded or uncompressed
      • Windows 2.0/3.1/95/98 style bitmaps all supported
    • Writing

      • 32bits (RGBA) per pixel images
      • 24bits (RGB) per pixel images
      • 8 bits greyscale (with palette)
    • Metadata (reading/writing): DPI information

  • Jpeg (.jpg, .jpeg)

    • Reading normal and interlaced baseline DCT image

      • YCbCr (default) CMYK/YCbCrK/RGB colorspaces
    • Writing non-interlaced JPG

      • YCbCr (favored), Y, RGB & CMYK colorspaces
    • Metadata:

      • Reading and writing DpiX & DpiY from JFIF header.
      • Reading & writing EXIF metadata. No GPS information can be written now.
  • Gif (.gif)

    • Reading single image & animated Gif image, handles interlaced images.
    • Writing single & animated Gif images.
    • No metadata.
  • Radiance (.pic, .hdr)

    • Reading
    • Writing
    • No metadata.
  • Tga

    • Reading
      • 8, 16, 24 & 32 bits
      • paletted and unpaletted
      • RLE encoded or uncompressed
    • Writing
      • uncompressed 8bits (Pixel8)
      • uncompressed 24bits (PixelRGB8)
      • uncompressed 32bits (PixelRGBA8)
    • No metadata
  • Tiff

    • Reading

      • 2, 4, 8, 16 int bit depth reading (planar and contiguous for each)

      • 32 bit floating point reading

      • CMYK, YCbCr, RGB, RGBA, Paletted, Greyscale

      • Uncompressed, PackBits, LZW

    • Writing

      • 8 and 16 bits
      • CMYK, YCbCr, RGB, RGBA, Greyscale
      • Uncompressed
    • Metadata: reading DpiX, DpiY and EXIF informations.

I love juicy pixels

You can make donations on this page.


Change log

v3.3.3 December 2018

* Enhanced: loading of bitmap format (thanks to CLowcay)
* Refactoring: exposing more internal modules (thanks to wyager)
* Refactoring: exposing dynamicMap & dynamicPixelMap
through `Codec.Picture` (thnks to LightAndLight)

v3.3.2 October 2018

* Fix: GHC-8.6 compilation fix (no upper bound on base)
* Fix: upper bound on containers (pull request phadej)
* Fix: palette validation for gifs (pull request omedan)
* New: More complete gif creation API (pull request omedan)

v3.3.1 August 2018

* Fix: gif decoding of 1bit palette (fix Ornedan)
* Fix: end of stream handling for gif's lzw encoding (fix Ornedan)

v3.3 July 2018

* New: Eq instances for image
* Fix: color gif resolution offset
* New: support for Float Tiff
* Breaking change: New `ImageY32` constructor for `Dynamic`
hence the version bump.

v3.2.9.5 March 2018

* Fix: uniform color quantization

v3.2.9.4 January 2018

* Compat for GHC-8.4 (pull request)
* Fix: a character in latin1 which was still around. Whatever.
So tired of this.

v3.2.9.3 December 2017

* Fix: remove bad invisible unicde char

v3.2.9.2 December 2017

* Fix: Progressive jpeg decoding when number of blocks of the MCU
is below line size

v3.2.9.1 November 2017

* Feature: Paletted alpha png saving

v3.2.9 November 2017

* Fix: Adding correct import of Exif Flash for Jpeg (thanks to Alexander Kjeldaas)
* Feature: Jpg Exif writing

v3.2.8.3 August 2017

* Fix: Jpeg loading of extended sequential jpg, not sure of all
the implications, works with the sample

v3.2.8.2 June 2017

* Fix: usage of fail in Either monad, giving an unwanted exception

v3.2.8.1 March 2016

* Fix: proper flushing of jpeg writing, avoiding warning from libjpeg.
* Fix: RGB jpeg get an Adobe's APP14 block to help MacOS & Photoshop reading

v3.2.8 September 2016

* Added: possibility to retrieve the parsed palette.
* Fix: Fixing problem of progressive Jpeg decoding when
block height is different of block width (#)

v3.2.7.2 June 2016

* Fix: no more libjpeg warning when decoding Juicy.Pixels encoded images.

v3.2.7.1 May 2016
* Fix: some wrongly infinitely looping JPEG decoding

v3.2.7 January 2016
* Addition: convertRGB8 and convertRGBA8 helper functions
* Addition: new output colorspace for JPEG format: Y, RGB & CMYK
* Addition: RGBA8 bitmap reading (thanks to mtolly)
* Enhancement: Optimized JPG & Tiff reading (thanks to Calvin Beck)
* Enhancement: INLINE SPECIALIZE for pixelMap (Pixel8 -> Pixel8) (thx to Calvin Beck)
* Fix: GHC 8.0 compilation (thanks to phadej)

v3.2.6.5 December 2015
* Fix: Compilation on GHC 7.6/7.8

v3.2.6.4 December 2015
* Fix: previous broken bugfix.

v3.2.6.3 November 2015
* Fix: Fixing unwanted sharing with createMutableImage due to
wrongly used INLINE pragma

v3.2.6.2 November 2015
* Fix: Using minimal GIF version if outputing a single image.

v3.2.6.1 August 2015
* Fix: handling of negative height & width in bitmap format.
* Fix: regression on Tiff parsing.

V3.2.6 August 2015

* Added: imageToTga saving helper function.
* Fix: don't invert TGA alpha channel.
* Fix: various typo in documentation.

V3.2.5.3 July 2015

* Fix: bumping vector upper bounds.

V3.2.5.2 June 2015

* Adding: Width & Height metdata to help querying image information
without decompressing the whole.
* Adding: Source format metadata.

v3.2.5.1 May 2015

* Fixing: utf-8 encoding of Jpg/Types causing problems with Haddock.

v3.2.5 May 2015

* Adding: Metadata extraction for various file format.
* Adding: Metadata writing for various file format.
* Adding: light EXIF mapping.
* Fix: handling of Tiff with predictors (thanks to Patrick Pelletier)

v3.2.4 April 2015

* Adding: Traversals compatible with the lens library.

v3.2.3.2 April 2015

* Bumping: zlib max bound

v3.2.3.1 March 2015

* Bumping: primitive to allow 0.6
* Fix: BMP output generated wrong size (thanks to mtolly).
* Fix: 7.10.1 warning free

v3.2.3 March 2015

* Adding: Support for RGB in jpeg (yeah, that exist...)
* Adding: Support of CMYK & YCrCbK color space in jpeg files.
* Addinng: a pixelFoldMap functions analog to the `foldMap` function
of the Foldable type class.
* Fix: better performances for the pixelFold* functions

v3.2.2 January 2015

* Fix: Squashing GHC 7.10 warnings

v3.2.1 December 2014
* Fix: Bumping deepseq dependencies preparing for GHC 7.10

v3.2 December 2014

*BREAKING CHANGES*: the Codec.Picture.Gif functions has changed interfaces.

* Adding: TGA reading.
* Adding: TGA writing.
* Adding: Packeable pixel unpack.
* Fix: Returning gif with transparency (breaking Codec.Picture.Gif interface)

v3.1.7.1 August 2014

* Previous gif fix was not working withing the readImage
function, only in specialized gif images. Correcting

v3.1.7 August 2014

* Making Juicy.Pixels compatible with GHC 7.9 HEAD (ggreif)
* Adding writing to uncompressed radiance file, due to
problems with Mac OS X "preview" application
* Fixing problem of gif parsing without global palette
* Some inlining annotations on some functions

v3.1.6.1 August 2014

* Fix of Gif palette creation (jeffreyrosenbluth)
* Restoring transformers 0.3.* compat

v3.1.6 August 2014

* Fix bad disposal handling in GIF animations.
* Added ColorConvertible instance for PixelRGB8 -> PixelRGBA16 (KaiHa)
* Fixing a bad handling of tRNS causing bad transprency decoding in
some circonstances.
* Adding the concept of Packeable pixel for faster pixel filling
using mutable array.

v3.1.5.2 May 2014

* Bumping the transformers dependency

v3.1.5.1 May 2014

* Adding some INLINE annotations for some pixel functions

v3.1.5 March 2014

* Typos and documentation proof reading fixes
(pull request from iger).
* Fix of progressive jpeg loading with more than two
huffman tables (4 allowed).
* Fix of progressive jpeg rendering (was too noisy before)
* Added loading of paletted bitmap files.
* Function to load gif images with frame duration
information (pull request from bit-shift)
* Fixing bug showing when loading JPEG with component
ID starting at 0.
* Adding reading for YA8 et YA16 Tiff images (pull
request from iger)
* Adding a mixWithAlpha method, to help work on transparent
pixel types

v3.1.4.1 February 2014

* Putting back data URI logo for cabal description, it's
apparently not supported by Hackage :-(

v3.1.4 February 2014

* Adding a pixelOpacity method to the pixel type class.
* Adding handling greyscale BMP files (phischu)
* Fixing promotePixel for Pixel8 -> Pixel16
* Some type fixes in the documentation
* Updating the pixel conversion graph
* Removed URI-encoded images, now using clean cabal embedding

v3.1.3.3 February 2014

* Lowering cabal version limit to be compiled with older GHCs

v3.1.3.2 January 2014

* Hacking around Binary to accept old version of it, down to version 0.5
allowing Juicy.Pixels to be compiled with GHC 6.3

v3.1.3.1 January 2014

* Fixing color counting function in color quantisation.
* Adding missing documentation for foreign pointer import.

v3.1.3 January 2014

* Adding palette creation (color Quantization) by Jeffrey Rosenbluth.
* Adding support for Gif writing
* Adding support for Gif animation writing
* Fixing some progressive Jpeg decoding problems (#39)

v3.1.2 December 2013

* Adding support for progressive jpeg.
* Adding support for plane separated MCU jpeg.
* Adding support for grayscale 32bit decoding (with reduced precision to
* Fixing erroneous bitmap decoding in case of excessive padding (#31).

v3.1.1.1 October 2013

* Fixing some spurious crash while decoding some JPEG image (#30).

v3.1.1 October 2013

* Adding uncompresed TIFF saving.
* Adding error message to avoid loading progressive loading.
* Made MMAP optional, controled by a cabal flag.
* adding dynamicPixelMap helper function.
* Handling png transparency using color key (#26).

v3.1 June 2013

* Adding basic handling of 16bits pixel types.
* Addition of Tiff reading:
- 2, 4, 8, 16 bit depth reading (planar and contiguous for each).
- CMYK, YCbCr, RGB, Paletted, Greyscale.
- Uncompressed, PackBits, LZW.
* Some new tiny helper functions (nothing too fancy).
* Huge performances improvement.

v3.0 January 2013

* Simplification of the 'Pixel' typeclass, removed many unused part.
* Removal of some Storable instances for pixel types.
* Amelioration of the documentation.
* Support for High Dynamic range images, opening support for different pixel
base component.
* Support for the Radiance file format (or RGBE, file extension .pic and .hdr).
* Dropped the cereal library in favor of the last version of Binary, present
in the Haskell platform. Every dependencies are now present in the platform.

v2.0.2 October 2012

* Decoding of interleaved gif image.
* Decoding delta coded gif animation.
* Bumping dependencies.

v2.0.1 September 2012

* Documentation enhancements.
* Fixing some huge gif file loading.
* Fixing performance problem of Bitmap and Jpeg savings.

v2.0 September 2012

* New extractComponent version with type safe plane extraction.
* Gif file reading.

v1.3 June 2012

* Fix extractComponent function.
* Adding saving for YA8 functions.

v1.2.1 April 2012

* Dependencies version bump.
* Dropping array dependency.

v1.2 March 2012

* Adding a generateImage helper function.
* Adding NFData instances for image.
* Adding JPEG writing.

v1.1 February 2012

* Switching to vector for arrays, big performance improvement.

v1.0 January 2012

* Initial release

comments powered byDisqus