| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vision.Image.Storage.DevIL
Description
Uses the DevIL C library to read and write images from and to files and memory buffers.
Please read our README to to get a detailed usage and some examples.
Note: As the underlying DevIL library is *not* tread-safe, there is a global lock which will prevent two load/save calls to be performed at the same time. The Haskell interface should be thread-safe but will not be able to benefit from multiple processing cores.
- data StorageImage
- data StorageError
- class ImageType t
- class ImageType t => LoadImageType t
- class ImageType t => SaveImageType t
- class ImageType t => SaveBSImageType t
- load :: (LoadImageType t, Convertible StorageImage i) => t -> FilePath -> IO (Either StorageError i)
- loadBS :: (LoadImageType t, Convertible StorageImage i) => t -> ByteString -> Either StorageError i
- save :: (SaveImageType t, Convertible i StorageImage) => t -> FilePath -> i -> IO (Maybe StorageError)
- saveBS :: (SaveBSImageType t, Convertible i StorageImage) => t -> i -> Either StorageError ByteString
- data Autodetect = Autodetect
- data BLP = BLP
- data BMP = BMP
- data CUT = CUT
- data DCX = DCX
- data DDS = DDS
- data DICOM = DICOM
- data Doom = Doom
- data DoomFlat = DoomFlat
- data DPX = DPX
- data EXR = EXR
- data FITS = FITS
- data FTX = FTX
- data GIF = GIF
- data HDR = HDR
- data ICO = ICO
- data ICNS = ICNS
- data IFF = IFF
- data IWI = IWI
- data JASCPAL = JASCPAL
- data JP2 = JP2
- data JPG = JPG
- data LIF = LIF
- data MDL = MDL
- data MNG = MNG
- data MP3 = MP3
- data PCD = PCD
- data PCX = PCX
- data PIC = PIC
- data PIX = PIX
- data PNG = PNG
- data PNM = PNM
- data PSD = PSD
- data PSP = PSP
- data PXR = PXR
- data RAW = RAW
- data ROT = ROT
- data SGI = SGI
- data SUN = SUN
- data Texture = Texture
- data TGA = TGA
- data TIFF = TIFF
- data TPL = TPL
- data UTX = UTX
- data VTF = VTF
- data WAL = WAL
- data WBMP = WBMP
- data XPM = XPM
Types & classes
data StorageImage Source
Constructors
| GreyStorage Grey | |
| RGBAStorage RGBA | |
| RGBStorage RGB |
Instances
| Show StorageImage | |
| NFData StorageImage | |
| Convertible RGB StorageImage | |
| Convertible RGBA StorageImage | |
| Convertible Grey StorageImage | |
| (Convertible Grey i, Convertible RGB i, Convertible RGBA i) => Convertible StorageImage i | Note: Convertible StorageImage StorageImage is provided by this instance. |
data StorageError Source
Constructors
| FailedToInit | Failed to initialise the library. |
| FailedToOpenFile | Failed to open the given file. |
| FailedToLoad | Failed to load the image, invalid format. |
| FailedToHaskell | Failed to convert the loaded image to its Haskell representation. |
| FailedToDevil | Failed to write the image content through the inner DevIL library. |
| FailedToSave | Failed to save the image. |
| FileAlreadyExists | The file already exists. |
| InvalidFile | The file could not be loaded because of an invalid value. |
| OutOfMemory | Could not allocate memory for the new image data. |
| UnknownFileType | The file content or extension does not match any known image type. |
| UnknownError (Maybe String) |
Instances
Minimal complete definition
Instances
class ImageType t => LoadImageType t Source
Instances
class ImageType t => SaveImageType t Source
Image types which can be loaded using save.
Instances
class ImageType t => SaveBSImageType t Source
Image types which can be loaded using saveBS.
Instances
Functions
load :: (LoadImageType t, Convertible StorageImage i) => t -> FilePath -> IO (Either StorageError i) Source
Reads an image from a file.
If the Autodetect image type is given, type will be determined
automatically with the file extension and the file headers.
loadBS :: (LoadImageType t, Convertible StorageImage i) => t -> ByteString -> Either StorageError i Source
Reads an image from a strict ByteString.
If the Autodetect image type is given, type will be determined
automatically with the file headers.
save :: (SaveImageType t, Convertible i StorageImage) => t -> FilePath -> i -> IO (Maybe StorageError) Source
Saves the image to the given file.
If the Autodetect image type is given, type will be determined
automatically with the file extension.
Note: will fail if the file already exists.
saveBS :: (SaveBSImageType t, Convertible i StorageImage) => t -> i -> Either StorageError ByteString Source
Saves the image into a manifest vector from a strict ByteString.
Images types
data Autodetect Source
Tries to determine automatically the image type with the header and/or the file extension.
Raises an UnknownFileType error if the detection failed.
Constructors
| Autodetect |
Constructors
| BMP |
Instances
Doom texture.
Constructors
| Doom |
Doom flat texture (floor).
Constructors
| DoomFlat |
Constructors
| EXR |
Instances
Constructors
| HDR |
Instances
Paint Shop Pro (Jasc) palette.
Constructors
| JASCPAL |
Constructors
| JPG |
Instances
Homeworld (.lif).
Constructors
| LIF |
Constructors
| PNG |
Instances
Paint Shop Pro image.
Constructors
| PSP |
Constructors
| SGI |
Instances
Medieval II: Total War Texture (.texture) file.
Constructors
| Texture |
Constructors
| TGA |
Instances
Constructors
| TIFF |
Instances
Constructors
| VTF |
Instances
Constructors
| WBMP |
Instances
Constructors
| XPM |
Instances