# WBMP IO

Read and write WBMP images.

Summary

WBMP IO | Read and write WBMP images.
Functions |
gdImageWBMPCtx | Write the image as a wbmp file
gdImageCreateFromWBMPCtx | Reads in a WBMP image via a gdIOCtx struct.
gdImageCreateFromWBMP | gdImageCreateFromWBMP is called to load images from WBMP format files.
gdImageCreateFromWBMPPtr |
gdImageWBMP |
gdImageWBMPPtr |

### Functions

### gdImageWBMPCtx

> void gdImageWBMPCtx( | gdImagePtr |  | image,
> | int |  | fg,
> | gdIOCtx | * | out | )

Write the image as a wbmp file

#### Parameters

image | gd image structure
fg | the index of the foreground color. any other value will be considered as background and will not be written
out | the stream where to write

### gdImageCreateFromWBMPCtx

> gdImagePtr gdImageCreateFromWBMPCtx( | gdIOCtx | * | infile | )

Reads in a WBMP image via a gdIOCtx struct. See gdImageCreateFromWBMP.

### gdImageCreateFromWBMP

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

gdImageCreateFromWBMP is called to load images from WBMP format files. Invoke gdImageCreateFromWBMP with an already opened pointer to a file containing the desired image. gdImageCreateFromWBMP returns a gdImagePtr to the new image, or NULL if unable to load the image (most often because the file is corrupt or does not contain a WBMP image). gdImageCreateFromWBMP does not close the file. You can inspect the sx and sy members of the image to determine its size. The image must eventually be destroyed using gdImageDestroy.

#### Variants

gdImageCreateFromWBMPPtr creates an image from WBMP data (i.e. the contents of a WBMP file) already in memory.

gdImageCreateFromWBMPCtx reads in an image using the functions in a gdIOCtx struct.

#### Parameters

infile | The input FILE pointer

#### Returns

A pointer to the new image or NULL if an error occurred.

#### Example

>     gdImagePtr im;
>     FILE *in;
>     in = fopen("mywbmp.wbmp", "rb");
>     im = gdImageCreateFromWBMP(in);
>     fclose(in);
>     // ... Use the image ...
>     gdImageDestroy(im);

### gdImageCreateFromWBMPPtr

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

#### Parameters

size | size of WBMP data in bytes.
data | WBMP data (i.e. contents of a WBMP file).

See gdImageCreateFromWBMP.

### gdImageWBMP

> void gdImageWBMP( | gdImagePtr |  | im,
> | int |  | fg,
> | FILE | * | outFile | )

### gdImageWBMPPtr

> void * gdImageWBMPPtr( | gdImagePtr |  | im,
> | int | * | size,
> | int |  | fg | )

> void gdImageWBMPCtx( | gdImagePtr |  | image,
> | int |  | fg,
> | gdIOCtx | * | out | )

Write the image as a wbmp file

> gdImagePtr gdImageCreateFromWBMPCtx( | gdIOCtx | * | infile | )

Reads in a WBMP image via a gdIOCtx struct.
gdIOCtx structures hold function pointers for doing image IO.

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

gdImageCreateFromWBMP is called to load images from WBMP format files.

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

> void gdImageWBMP( | gdImagePtr |  | im,
> | int |  | fg,
> | FILE | * | outFile | )

> void * gdImageWBMPPtr( | gdImagePtr |  | im,
> | int | * | size,
> | int |  | fg | )

> void gdImageDestroy ( | gdImagePtr | im | )

gdImageDestroy is used to free the memory associated with an image.
Close