image-type: Determine the type of an image by reading the first bytes.

[ bsd3, graphics, library ] [ Propose Tags ]

A package used to determine the type of an image according to its first bytes based on the Python library imghdr.

Most simplest usage is getting the type of a file:

>>> import Codec.ImageType
>>> getFileType "/tmp/mystery_file"
Just "webp"

Or to test for a specific extension:

>>> isPgm "/tmp/file.pgm"
True
>>> import qualified Data.ByteString as B
>>> testPgm <$> B.readFile "/tmp/file.pgm"
Just "pgm"

Or to filter files by extension:

>>> import Codec.ImageType
>>> import Control.Monad
>>> import System.Directory
>>> 
>>> getDirectoryContents "." >>= filterM doesFileExist >>= filterM isJpeg
["file2.jpeg","file1.jpeg"]

Supports the following extensions: JPEG, PNG, GIF, TIFF, RGB, PBM, PGM, PPM, RAST, XBM, BMP, WebP, EXR.

Versions 0.1.0.0
Dependencies base (==4.*), bytestring (>=0.9 && <0.11) [details]
License BSD-3-Clause
Author Baldur Blöndal
Maintainer baldurpet@gmail.com
Revised Revision 1 made by BaldurBlondal at Tue Aug 5 04:20:48 UTC 2014
Category Graphics
Home page https://github.com/Icelandjack/Image-type
Uploaded by BaldurBlondal at Mon Aug 4 17:27:07 UTC 2014
Distributions NixOS:0.1.0.0
Downloads 635 total (11 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees