Read and write HEIF images.
HEIF IO | Read and write HEIF images. |
Functions | |
gdImageCreateFromHeif | gdImageCreateFromHeif is called to load truecolor images from HEIF format files. |
gdImageCreateFromHeifPtr | See gdImageCreateFromHeif. |
gdImageCreateFromHeifCtx | See gdImageCreateFromHeif. |
gdImageHeifCtx | Write the image as HEIF data via a gdIOCtx. |
gdImageHeifEx | gdImageHeifEx outputs the specified image to the specified file in HEIF format. |
gdImageHeif | Variant of gdImageHeifEx which uses the default quality (-1), the default codec (GD_HEIF_Codec_HEVC) and the default chroma subsampling (GD_HEIF_CHROMA_444). |
gdImageHeifPtr | See gdImageHeifEx. |
gdImageHeifPtrEx | See gdImageHeifEx. |
gdImagePtr gdImageCreateFromHeif( FILE * inFile )
gdImageCreateFromHeif is called to load truecolor images from HEIF format files. Invoke gdImageCreateFromHeif with an already opened pointer to a file containing the desired image. gdImageCreateFromHeif returns a gdImagePtr to the new truecolor image, or NULL if unable to load the image (most often because the file is corrupt or does not contain a HEIF image). gdImageCreateFromHeif 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.
The returned image is always a truecolor image.
infile | The input FILE pointer. |
A pointer to the new truecolor image. This will need to be destroyed with gdImageDestroy once it is no longer needed.
On error, returns NULL.
void gdImageHeifCtx( gdImagePtr im, gdIOCtx * outfile, int quality, gdHeifCodec codec, gdHeifChroma chroma )
Write the image as HEIF data via a gdIOCtx. See gdImageHeifEx for more details.
im | The image to write. |
outfile | The output sink. |
quality | Image quality. |
codec | The output coding format. |
chroma | The output chroma subsampling format. |
Nothing.
void gdImageHeifEx( gdImagePtr im, FILE * outFile, int quality, gdHeifCodec codec, gdHeifChroma chroma )
gdImageHeifEx outputs the specified image to the specified file in HEIF 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. gdImageHeifEx does not close the file; your code must do so.
If quality is -1, a reasonable quality value (which should yield a good general quality / size tradeoff for most situations) is used. Otherwise quality should be a value in the range 0-100, higher quality values usually implying both higher quality and larger image sizes or 200, for lossless codec.
gdImageHeifCtx stores the image using a gdIOCtx struct.
gdImageHeifPtrEx stores the image to RAM.
im | The image to save. |
outFile | The FILE pointer to write to. |
quality | Codec quality (0-100). |
codec | The output coding format. |
chroma | The output chroma subsampling format. |
Nothing.
void gdImageHeif( gdImagePtr im, FILE * outFile )
Variant of gdImageHeifEx which uses the default quality (-1), the default codec (GD_HEIF_Codec_HEVC) and the default chroma subsampling (GD_HEIF_CHROMA_444).
im | The image to save |
outFile | The FILE pointer to write to. |
Nothing.
void * gdImageHeifPtr( gdImagePtr im, int * size )
See gdImageHeifEx.
void * gdImageHeifPtrEx( gdImagePtr im, int * size, int quality, gdHeifCodec codec, gdHeifChroma chroma )
See gdImageHeifEx.
gdImageCreateFromHeif is called to load truecolor images from HEIF format files.
gdImagePtr gdImageCreateFromHeif( FILE * inFile )
See gdImageCreateFromHeif.
gdImagePtr gdImageCreateFromHeifPtr( int size, void * data )
See gdImageCreateFromHeif.
gdImagePtr gdImageCreateFromHeifCtx( gdIOCtx * infile )
Write the image as HEIF data via a gdIOCtx.
void gdImageHeifCtx( gdImagePtr im, gdIOCtx * outfile, int quality, gdHeifCodec codec, gdHeifChroma chroma )
gdImageHeifEx outputs the specified image to the specified file in HEIF format.
void gdImageHeifEx( gdImagePtr im, FILE * outFile, int quality, gdHeifCodec codec, gdHeifChroma chroma )
Variant of gdImageHeifEx which uses the default quality (-1), the default codec (GD_HEIF_Codec_HEVC) and the default chroma subsampling (GD_HEIF_CHROMA_444).
void gdImageHeif( gdImagePtr im, FILE * outFile )
See gdImageHeifEx.
void * gdImageHeifPtr( gdImagePtr im, int * size )
See gdImageHeifEx.
void * gdImageHeifPtrEx( gdImagePtr im, int * size, int quality, gdHeifCodec codec, gdHeifChroma chroma )
gdImageDestroy is used to free the memory associated with an image.
void gdImageDestroy ( gdImagePtr im )