## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iImageIO Struct Reference
[2D]

The iImageIO interface is used to save and load graphic files. More...

`#include <igraphic/imageio.h>`

Inheritance diagram for iImageIO:

[legend]
List of all members.

## Public Types

typedef csImageIOFileFormatDescription | FileFormatDescription
| Description for a file format supported by an image loader.

## Public Member Functions

virtual const csImageIOFileFormatDescriptions & | GetDescription ()=0
| Propagate the image fileformats handled by this plugin.
virtual csPtr< iImage > | Load (iDataBuffer *buf, int iFormat)=0
| Load an image from a buffer.
virtual csPtr< iDataBuffer > | Save (iImage *image, const char *mime=0, const char *extraoptions=0)=0
| Save an image using format MIME.
virtual csPtr< iDataBuffer > | Save (iImage *image, FileFormatDescription *format, const char *extraoptions=0)=0
| Save an image using a prefered format.
virtual void | SetDithering (bool iEnable)=0
| Set global image dithering option.

## Detailed Description

The iImageIO interface is used to save and load graphic files.

Definition at line 66 of file imageio.h.

## Member Typedef Documentation

typedef csImageIOFileFormatDescription iImageIO::FileFormatDescription

| Description for a file format supported by an image loader. Definition at line 69 of file imageio.h.

## Member Function Documentation

virtual const csImageIOFileFormatDescriptions& iImageIO::GetDescription | ( |  | ) | `[pure virtual]`

| Propagate the image fileformats handled by this plugin.

virtual csPtr<iImage> iImageIO::Load | ( | iDataBuffer * | buf,
|  | int | iFormat
| ) | `[pure virtual]`

Load an image from a buffer.

This routine will read from the buffer buf , try to recognize the type of image contained within, and return an csImageFile of the appropriate type. Returns a pointer to the iImage on success, or 0 on failure. The bits that fit the CS_IMGFMT_MASK mask are mandatory: the image always will be loaded in the appropiate format; the bits outside that mask (i.e. CS_IMGFMT_ALPHA) are optional: if the image does not contain alpha mask, the GetFormat() method of the image will return a value without that bit set.

virtual csPtr<iDataBuffer> iImageIO::Save | ( | iImage * | image,
|  | const char * | mime = `0`,
|  | const char * | extraoptions = `0`
| ) | `[pure virtual]`

| Save an image using format MIME. If omitted format selection is left to the plugin.

virtual csPtr<iDataBuffer> iImageIO::Save | ( | iImage * | image,
|  | FileFormatDescription * | format,
|  | const char * | extraoptions = `0`
| ) | `[pure virtual]`

Save an image using a prefered format.

`extraoptions` allows to specify additional output options. Those options consist of a comma-separated list and can be either 'option' or 'option=value'. The available options vary from plugin to plugin, some common ones are:

`compress=#` - Set image compression, from 0..100. Higher values give smaller files, but at the expense of quality(e.g. JPEG) or speed(e.g. PNG).
`progressive` - Progressive/interlaced encoding.

Examples:
`compress=50`
`progressive,compress=30`

virtual void iImageIO::SetDithering | ( | bool | iEnable | ) | `[pure virtual]`

| Set global image dithering option. By default this option is disabled. If you enable it, all images will be dithered both after loading and after mipmapping/scaling. This will affect all truecolor->paletted image conversions.

The documentation for this struct was generated from the following file:

- igraphic/imageio.h