# BMP IO

Read and write BMP images.

Summary

BMP IO | Read and write BMP images.
Functions |
gdImageBmpPtr | Outputs the given image as BMP data, but using a gdIOCtx instead of a file.
gdImageBmp | gdImageBmp outputs the specified image to the specified file in BMP format.
gdImageBmpCtx | Outputs the given image as BMP data, but using a gdIOCtx instead of a file.
gdImageCreateFromBmp |
gdImageCreateFromBmpPtr |
gdImageCreateFromBmpCtx |

### Functions

### gdImageBmpPtr

> void * gdImageBmpPtr( | gdImagePtr |  | im,
> | int | * | size,
> | int |  | compression | )

Outputs the given image as BMP data, but using a gdIOCtx instead of a file. See gdImageBmp.

#### Parameters

im | the image to save.
size | Output: size in bytes of the result.
compression | whether to apply RLE or not.

#### Returns

A pointer to memory containing the image data or NULL on error.

### gdImageBmp

> void gdImageBmp( | gdImagePtr |  | im,
> | FILE | * | outFile,
> | int |  | compression | )

gdImageBmp outputs the specified image to the specified file in BMP format. The file must be open for writing. Under MSDOS and all versions of Windows, it is important to use “wb” as opposed to simply “w” as the mode when opening the file, and under Unix there is no penalty for doing so. gdImageBmp does not close the file; your code must do so.

In addition, gdImageBmp allows to specify whether RLE compression should be applied.

#### Variants

gdImageBmpCtx write via a gdIOCtx instead of a file handle.

gdImageBmpPtr store the image file to memory.

#### Parameters

im | the image to save.
outFile | the output FILE* object.
compression | whether to apply RLE or not.

#### Returns

nothing

### gdImageBmpCtx

> void gdImageBmpCtx( | gdImagePtr | im,
> | gdIOCtxPtr | out,
> | int | compression | )

Outputs the given image as BMP data, but using a gdIOCtx instead of a file. See gdImageBmp.

#### Parameters

im | the image to save.
out | the gdIOCtx to write to.
compression | whether to apply RLE or not.

### gdImageCreateFromBmp

> gdImagePtr gdImageCreateFromBmp( | FILE | * | inFile | )

### gdImageCreateFromBmpPtr

> gdImagePtr gdImageCreateFromBmpPtr( | int |  | size,
> | void | * | data | )

### gdImageCreateFromBmpCtx

> gdImagePtr gdImageCreateFromBmpCtx( | gdIOCtxPtr | infile | )

> void * gdImageBmpPtr( | gdImagePtr |  | im,
> | int | * | size,
> | int |  | compression | )

Outputs the given image as BMP data, but using a gdIOCtx instead of a file.
gdIOCtx structures hold function pointers for doing image IO.

> void gdImageBmp( | gdImagePtr |  | im,
> | FILE | * | outFile,
> | int |  | compression | )

gdImageBmp outputs the specified image to the specified file in BMP format.

> void gdImageBmpCtx( | gdImagePtr | im,
> | gdIOCtxPtr | out,
> | int | compression | )

Outputs the given image as BMP data, but using a gdIOCtx instead of a file.

> gdImagePtr gdImageCreateFromBmp( | FILE | * | inFile | )

> gdImagePtr gdImageCreateFromBmpPtr( | int |  | size,
> | void | * | data | )

> gdImagePtr gdImageCreateFromBmpCtx( | gdIOCtxPtr | infile | )

Close