JuicyPixels-3.3.8: Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance)
Safe HaskellNone
LanguageHaskell2010

Codec.Picture.Jpg

Description

Module used for JPEG file loading and writing.

Synopsis

Documentation

decodeJpeg :: ByteString -> Either String DynamicImage Source #

Try to decompress and decode a jpeg file. The colorspace is still YCbCr if you want to perform computation on the luma part. You can convert it to RGB using convertImage from the ColorSpaceConvertible typeclass.

This function can output the following images:

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

Equivalent to decodeJpeg but also extracts metadatas.

Extract the following metadatas from the JFIF block:

Exif metadata are also extracted if present.

encodeJpegAtQuality Source #

Arguments

:: Word8

Quality factor

-> Image PixelYCbCr8

Image to encode

-> ByteString

Encoded JPEG

Function to call to encode an image to jpeg. The quality factor should be between 0 and 100 (100 being the best quality).

encodeJpegAtQualityWithMetadata Source #

Arguments

:: Word8

Quality factor

-> Metadatas 
-> Image PixelYCbCr8

Image to encode

-> ByteString

Encoded JPEG

Equivalent to encodeJpegAtQuality, but will store the following metadatas in the file using a JFIF block:

encodeDirectJpegAtQualityWithMetadata Source #

Arguments

:: forall px. JpgEncodable px 
=> Word8

Quality factor

-> Metadatas 
-> Image px

Image to encode

-> ByteString

Encoded JPEG

Equivalent to encodeJpegAtQuality, but will store the following metadatas in the file using a JFIF block:

This function also allow to create JPEG files with the following color space:

  • Y (Pixel8) for greyscale.
  • RGB (PixelRGB8) with no color downsampling on any plane
  • CMYK (PixelCMYK8) with no color downsampling on any plane

encodeJpeg :: Image PixelYCbCr8 -> ByteString Source #

Encode an image in jpeg at a reasonnable quality level. If you want better quality or reduced file size, you should use encodeJpegAtQuality

class (Pixel px, PixelBaseComponent px ~ Word8) => JpgEncodable px Source #

Helper type class describing all JPG-encodable pixel types

Minimal complete definition

componentsOfColorSpace, encodingState, scanSpecificationOfColorSpace

Instances

Instances details
JpgEncodable PixelCMYK8 Source # 
Instance details

Defined in Codec.Picture.Jpg

JpgEncodable PixelYCbCr8 Source # 
Instance details

Defined in Codec.Picture.Jpg

JpgEncodable PixelRGB8 Source # 
Instance details

Defined in Codec.Picture.Jpg

JpgEncodable Pixel8 Source # 
Instance details

Defined in Codec.Picture.Jpg