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

Safe Haskell | None
Language | Haskell2010

Codec.Picture.Tiff

Description

Module implementing TIFF decoding.

Supported compression schemes:

- Uncompressed
- PackBits
- LZW

Supported bit depth:

- 2 bits
- 4 bits
- 8 bits
- 16 bits

Synopsis

- decodeTiff :: ByteString -> Either String DynamicImage
- decodeTiffWithMetadata :: ByteString -> Either String (DynamicImage, Metadatas)
- decodeTiffWithPaletteAndMetadata :: ByteString -> Either String (PalettedImage, Metadatas)
- class Pixel px => TiffSaveable px
- encodeTiff :: forall px. TiffSaveable px => Image px -> ByteString
- writeTiff :: TiffSaveable pixel => FilePath -> Image pixel -> IO ()

# Documentation

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 images:

- `ImageY8`
- `ImageY16`
- `ImageY32`
- `ImageYF`
- `ImageYA8`
- `ImageYA16`
- `ImageRGB8`
- `ImageRGB16`
- `ImageRGBA8`
- `ImageRGBA16`
- `ImageCMYK8`
- `ImageCMYK16`

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.

decodeTiffWithPaletteAndMetadata :: ByteString -> Either String (PalettedImage, Metadatas) Source #

Decode TIFF and provide separated palette and metadata

class Pixel px => TiffSaveable px Source #

Class defining which pixel types can be serialized in a Tiff file.

Minimal complete definition

colorSpaceOfPixel

#### Instances

Instances details

TiffSaveable PixelRGBA16 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelRGBA16 -> TiffColorspace extraSampleCodeOfPixel :: PixelRGBA16 -> Maybe ExtraSample subSamplingInfo :: PixelRGBA16 -> Vector Word32 sampleFormat :: PixelRGBA16 -> [TiffSampleFormat]
TiffSaveable PixelRGBA8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelRGBA8 -> TiffColorspace extraSampleCodeOfPixel :: PixelRGBA8 -> Maybe ExtraSample subSamplingInfo :: PixelRGBA8 -> Vector Word32 sampleFormat :: PixelRGBA8 -> [TiffSampleFormat]
TiffSaveable PixelCMYK16 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelCMYK16 -> TiffColorspace extraSampleCodeOfPixel :: PixelCMYK16 -> Maybe ExtraSample subSamplingInfo :: PixelCMYK16 -> Vector Word32 sampleFormat :: PixelCMYK16 -> [TiffSampleFormat]
TiffSaveable PixelCMYK8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelCMYK8 -> TiffColorspace extraSampleCodeOfPixel :: PixelCMYK8 -> Maybe ExtraSample subSamplingInfo :: PixelCMYK8 -> Vector Word32 sampleFormat :: PixelCMYK8 -> [TiffSampleFormat]
TiffSaveable PixelYCbCr8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelYCbCr8 -> TiffColorspace extraSampleCodeOfPixel :: PixelYCbCr8 -> Maybe ExtraSample subSamplingInfo :: PixelYCbCr8 -> Vector Word32 sampleFormat :: PixelYCbCr8 -> [TiffSampleFormat]
TiffSaveable PixelRGB16 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelRGB16 -> TiffColorspace extraSampleCodeOfPixel :: PixelRGB16 -> Maybe ExtraSample subSamplingInfo :: PixelRGB16 -> Vector Word32 sampleFormat :: PixelRGB16 -> [TiffSampleFormat]
TiffSaveable PixelRGB8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelRGB8 -> TiffColorspace extraSampleCodeOfPixel :: PixelRGB8 -> Maybe ExtraSample subSamplingInfo :: PixelRGB8 -> Vector Word32 sampleFormat :: PixelRGB8 -> [TiffSampleFormat]
TiffSaveable PixelYA16 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelYA16 -> TiffColorspace extraSampleCodeOfPixel :: PixelYA16 -> Maybe ExtraSample subSamplingInfo :: PixelYA16 -> Vector Word32 sampleFormat :: PixelYA16 -> [TiffSampleFormat]
TiffSaveable PixelYA8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelYA8 -> TiffColorspace extraSampleCodeOfPixel :: PixelYA8 -> Maybe ExtraSample subSamplingInfo :: PixelYA8 -> Vector Word32 sampleFormat :: PixelYA8 -> [TiffSampleFormat]
TiffSaveable PixelF Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: PixelF -> TiffColorspace extraSampleCodeOfPixel :: PixelF -> Maybe ExtraSample subSamplingInfo :: PixelF -> Vector Word32 sampleFormat :: PixelF -> [TiffSampleFormat]
TiffSaveable Pixel32 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: Pixel32 -> TiffColorspace extraSampleCodeOfPixel :: Pixel32 -> Maybe ExtraSample subSamplingInfo :: Pixel32 -> Vector Word32 sampleFormat :: Pixel32 -> [TiffSampleFormat]
TiffSaveable Pixel16 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: Pixel16 -> TiffColorspace extraSampleCodeOfPixel :: Pixel16 -> Maybe ExtraSample subSamplingInfo :: Pixel16 -> Vector Word32 sampleFormat :: Pixel16 -> [TiffSampleFormat]
TiffSaveable Pixel8 Source # |
Instance details Defined in Codec.Picture.Tiff Methods colorSpaceOfPixel :: Pixel8 -> TiffColorspace extraSampleCodeOfPixel :: Pixel8 -> Maybe ExtraSample subSamplingInfo :: Pixel8 -> Vector Word32 sampleFormat :: Pixel8 -> [TiffSampleFormat]

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.