thumbnail-plus-1.0.4: Generate thumbnails easily and safely.

Safe HaskellNone

Graphics.ThumbnailPlus

Synopsis

Documentation

createThumbnailsSource

Arguments

:: MonadResource m 
=> Configuration

Configuration values (use def for default values).

-> FilePath

Input image file path.

-> m CreatedThumbnails 

Process an image and generate thumbnails for it according to the given Configuration.

data Configuration Source

Configuration used when

Constructors

Configuration 

Fields

maxFileSize :: !Integer

Maximum file size in bytes. Files larger than this limit are rejected. Default: 5 MiB.

maxImageSize :: !Size

Maximum image size in pixels. Images which exceed this limit in any dimension are rejected. Default: 3000x3000px.

reencodeOriginal :: !ReencodeOriginal

Whether the original image should be reencoded. Default: SameFileFormat.

thumbnailSizes :: [(Size, Maybe FileFormat)]

The sizes of the thumbnails that should be created. Thumbnails preserve the aspect ratio and have at least one dimension equal to the given requested size. Sizes larger than the original image will be disregarded. If a FileFormat is not provided, the same file format as the original image is reused. Default: 512x512, 64x64.

temporaryDirectory :: IO FilePath

Temporary directory where files should be saved. Default: getTemporaryDirectory.

data Size

Constructors

Size 

Fields

width :: Int
 
height :: Int
 

data ReencodeOriginal Source

Whether the original image should be reencoded or not (cf., reencodeOriginal).

Constructors

Never

Do not reencode the original image.

SameFileFormat

Reencode the original using the same file format.

NewFileFormat !FileFormat

Reencode the original using the given file format.

data CreatedThumbnails Source

Return value of createThumbnails.

Constructors

FileSizeTooLarge !Integer

File size exceeded maxFileSize.

ImageSizeTooLarge !Size

Image size exceeded maxImageSize.

ImageFormatUnrecognized

Could not parse size information for the image. Remember that we understand JPGs, PNGs and GIFs only.

CreatedThumbnails ![Thumbnail] !(NoShow ReleaseKey)

Thumbnails were created successfully. If reencodeOriginal was not Never, then the first item of the list is going to be the reencoded image.

data Thumbnail Source

Information about a generated thumbnail. Note that if ask for the original image to be reencoded, then the first Thumbnail will actually have the size of the original image.

Constructors

Thumbnail 

Fields

thumbFp :: !FilePath

The FilePath where this thumbnail is stored.

thumbSize :: !Size

Size of the thumbnail.

thumbFormat :: !FileFormat
 
thumbReleaseKey :: !(NoShow ReleaseKey)

Release key that may be used to clean up any resources used by this thumbnail as soon as possible (i.e., before runResourceT finishes).

newtype NoShow a Source

Hack to allow me to derive Show for data types with fields that don't have Show instances.

Constructors

NoShow a 

Instances

Eq (NoShow a) 
Typeable a => Show (NoShow a)