Decode and resize a frame from a file on the filesystem
#include <img.h> int img_load_resize_file( img_lib_t ilib, const char* path, const img_decode_callouts_t* callouts, img_t* img );
If you set the image width and height (img.w and img.h) before calling this function, then the image is be sized to fit the specified dimensions rather than clipped, as it is with img_load_file(). The resizing is performed on-the-fly during the decode, without incurring the memory penalty of loading the entire original image and then subsequently resizing it.
If you specify only one of the dimensions, then the other is calculated based on the aspect ratio of the original image.
You need to also set the corresponding dimension flag in the img structure. For example, if you specify the width, you need to set the IMG_W bit in flags. |
img
This function decodes a frame from a file on the filesystem, and optionally resizes it if the image width and height is specified. This function decodes only the first frame encountered.
Image library
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
img_decode_callouts_t, img_load_file(), img_load(), img_t, img_lib_attach()