image-type-0.1.0.0: image-type.cabal
-- Initial image-type.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: image-type
version: 0.1.0.0
synopsis: Determine the type of an image by reading the first bytes.
description: A package used to determine the type of an image according to its first bytes based on the Python library <https://docs.python.org/3/library/imghdr.html 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@.
.
homepage: https://github.com/Icelandjack/Image-type
license: BSD3
license-file: LICENSE
author: Baldur Blöndal
maintainer: baldurpet@gmail.com
-- copyright:
category: Graphics
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
library
exposed-modules: Codec.ImageType
-- other-modules:
-- other-extensions:
build-depends: base == 4.*,
bytestring >=0.9 && <0.11
-- hs-source-dirs:
default-language: Haskell98