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

Safe HaskellNone

Graphics.ThumbnailPlus.ImageSize

Description

Detect the image size without opening the image itself.

Amazingly, reimplementing this wheel is the recommended way of not processing huge images according to gd's FAQ. We hope to be at least as restrictive as gd itself is, otherwise some malicious image could get past this code and blow on gd's hand.

This code has been ressurected by the now-deprecated imagesize-conduit library by Michael Snoyman.

Synopsis

Documentation

data Size Source

Constructors

Size 

Fields

width :: Int
 
height :: Int
 

sinkImageInfo :: Monad m => Consumer ByteString m (Maybe (Size, FileFormat))Source

Find out the size of an image. Also returns the file format that parsed correctly. Note that this function does not verify that the file is indeed in the format that it returns, since it looks only at a small part of the header.