Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 8
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 );
- ilib
- A handle for the image library, returned by img_lib_attach().
- path
- The full path to the file from which the data can be read.
- callouts
- Unsupported; set to NULL.
- img
- The address of an img_t structure the function fills in with information about the decoded frame.
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.
- IMG_ERR_OK
- Success
- IMG_ERR_CORRUPT
- Invalid data encountered in the file, preventing the decode from proceeding. Some of the frame may be intact.
- IMG_ERR_DLL
- An error occurred processing the DLL that handles the file type. Check to make sure that the DLL is not missing or corrupt.
- IMG_ERR_FILE
- Error accessing path (errno is set).
- IMG_ERR_FORMAT
- No appopriate codec could be found. The codec you require could be missing or corrupt, or the file could be corrupt.
- IMG_ERR_INTR
- Decode was interrupted by application.
- IMG_ERR_MEM
- Memory-allocation failure.
- IMG_ERR_NODATA
- No frame data was present. This error is highly unlikely, as files generally contain at least one frame.
- IMG_ERR_NOSUPPORT
- Output data not supported; the codec and application could not agree on an output format.
- IMG_ERR_TRUNC
- Premature end of file encountered. Some of the frame may be intact.
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()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 194
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_load_resize_file.html on line 194