|
LibGd 2.4.0-dev
GD Graphics library
|
Read and write libgd's native .gd image format. More...

GD Reading | |
| gdImagePtr | gdImageCreateFromGd (FILE *in) |
| Create an image from a GD stdio file. | |
| gdImagePtr | gdImageCreateFromGdCtx (gdIOCtxPtr in) |
| Create an image from GD data read through a gdIOCtx. | |
| gdImagePtr | gdImageCreateFromGdPtr (int size, void *data) |
| Create an image from a GD memory buffer. | |
GD Writing | |
| void * | gdImageGdPtr (gdImagePtr im, int *size) |
| Write an image as GD data to a newly allocated memory buffer. | |
| void | gdImageGd (gdImagePtr im, FILE *out) |
| Write an image as GD data to a stdio file. | |
Read and write libgd's native .gd image format.
The GD format is libgd's own historical image dump format. It is obsolete for interchange and should generally be used only for development, testing, or compatibility with existing .gd assets. For compressed or portable image exchange, prefer formats such as PNG, JPEG, WebP, or AVIF.
gd can read GD 1.x palette .gd files and GD 2.x palette or truecolor .gd files. The writer always emits the GD 2.x .gd format, not the related GD2 chunked format documented separately by the GD2 APIs. Returned gdImagePtr images are owned by the caller and must be destroyed with gdImageDestroy.
| gdImagePtr gdImageCreateFromGd | ( | FILE * | in | ) |
Create an image from a GD stdio file.
gdImageCreateFromGd() reads from the current position of in and does not close it. On success, the returned image is owned by the caller and must be destroyed with gdImageDestroy.
| in | Pointer to the GD FILE stream to read. |
| gdImagePtr gdImageCreateFromGdCtx | ( | gdIOCtxPtr | in | ) |
Create an image from GD data read through a gdIOCtx.
gdImageCreateFromGdCtx() reads from in and does not close it. On success, the returned image is owned by the caller and must be destroyed with gdImageDestroy.
| in | Pointer to the gdIOCtx input context. |
| gdImagePtr gdImageCreateFromGdPtr | ( | int | size, |
| void * | data | ||
| ) |
Create an image from a GD memory buffer.
gdImageCreateFromGdPtr() borrows data for the duration of the call. The caller retains ownership of the input buffer. On success, the returned image is owned by the caller and must be destroyed with gdImageDestroy.
| size | Size of the GD memory buffer in bytes. |
| data | Pointer to the GD memory buffer. |
| void gdImageGd | ( | gdImagePtr | im, |
| FILE * | out | ||
| ) |
Write an image as GD data to a stdio file.
gdImageGd() writes the image in GD 2.x .gd format. The image and out stream are borrowed for the duration of the call, and out is not closed by gd.
| im | The image to write. |
| out | Pointer to the output FILE stream. |
| void * gdImageGdPtr | ( | gdImagePtr | im, |
| int * | size | ||
| ) |
Write an image as GD data to a newly allocated memory buffer.
gdImageGdPtr() writes the image in GD 2.x .gd format. The image is borrowed for the duration of the call. On success, the returned buffer is owned by the caller and must be freed with gdFree().
| im | The image to write. |
| size | Output location for the returned buffer size in bytes. |