Skip to content

Provides functions to load images from files using bindings to the DevIL C library.

License

Notifications You must be signed in to change notification settings

Wollw/friday-devil

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Provides bindings to the DevIL image library to load and save friday images.

DevIL is a fast image library written in C. The library must be installed on the host system before usage.

Supports a wide variety of image formats, including BMP, JPG, PNG, GIF, ICO and PSD.

Quick tour

Storage images

Images returned from load or passed to save must be Convertile from and to StorageImages. The StorageImage type is defined as:

data StorageImage = GreyStorage Grey | RGBAStorage RGBA | RGBStorage RGB

The following example reads an image from a file, automatically determining the image format, and then writes it back into a ByteString as a greyscale PNG image.

{-# LANGUAGE ScopedTypeVariables #-}
main = do
    io <- load Autodetect "image.jpg"
    case io of
        Right (rgb :: RGB) -> -- Forces the RGB colorspace for the loaded image.
            let grey = convert rgb :: Grey
                bs   = saveBS PNG grey
            in print bs
        Left err           -> do
            putStrLn "Unable to load the image:"
            print err

See the friday-examples package for a set of examples.

About

Provides functions to load images from files using bindings to the DevIL C library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Haskell 100.0%