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

Safe HaskellNone



Module implementing TIFF decoding.

Supported compression schemes:

  • Uncompressed
  • PackBits
  • LZW

Supported bit depth:

  • 2 bits
  • 4 bits
  • 8 bits
  • 16 bits



decodeTiff :: ByteString -> Either String DynamicImage Source

Decode a tiff encoded image while preserving the underlying pixel type (except for Y32 which is truncated to 16 bits).

This function can output the following pixel types:

  • PixelY8
  • PixelY16
  • PixelYA8
  • PixelYA16
  • PixelRGB8
  • PixelRGB16
  • PixelRGBA8
  • PixelRGBA16
  • PixelCMYK8
  • PixelCMYK16

decodeTiffWithMetadata :: ByteString -> Either String (DynamicImage, Metadatas) Source

Like decodeTiff but also provides some metdata present in the Tiff file.

The metadata extracted are the DpiX & DpiY information alongside the EXIF informations.

encodeTiff :: forall px. TiffSaveable px => Image px -> ByteString Source

Transform an image into a Tiff encoded bytestring, ready to be written as a file.

writeTiff :: TiffSaveable pixel => FilePath -> Image pixel -> IO () Source

Helper function to directly write an image as a tiff on disk.