Leptonica 1.68
C Image Processing Library
|
Read/write webp format from/to file. More...
Go to the source code of this file.
Functions | |
PIX * | pixReadStreamWebP (FILE *fp) |
l_int32 | readHeaderWebP (const char *filename, l_int32 *pwidth, l_int32 *pheight) |
l_int32 | pixWriteWebP (const char *filename, PIX *pixs, l_int32 quality) |
l_int32 | pixWriteStreamWebP (FILE *fp, PIX *pixs, l_int32 quality) |
l_int32 | pixWriteWebPwithTargetPSNR (const char *filename, PIX *pixs, l_float64 target_psnr, l_int32 *pquality) |
Read/write webp format from/to file.
Read WebP from file PIX *pixReadStreamWebP() l_int32 readHeaderWebP() Write WebP to file l_int32 pixWriteWebP() [ special top level ] l_int32 pixWriteStreamWebP() Write WebP to file with target psnr l_int32 pixWriteWebPwithTargetPSNR
Definition in file webpio.c.
PIX* pixReadStreamWebP | ( | FILE * | fp | ) |
Input: stream corresponding to WebP image Return: pix (32 bpp), or null on error
Notes: (1) Use 'free', and not leptonica's 'FREE', for all heap data that is returned from the WebP library.
Definition at line 61 of file webpio.c.
References ERROR_PTR, FREE, l_binaryReadStream(), NULL, pixCreate(), pixDestroy(), pixEndianByteSwap(), pixGetData(), pixGetWpl(), and PROCNAME.
Referenced by pixReadStream().
Input: filename &width (<return>) &height (<return>) Return: 0 if OK, 1 on error
Definition at line 114 of file webpio.c.
References ERROR_INT, fopenReadStream(), NULL, and PROCNAME.
Referenced by pixReadHeader().
Input: filename pixs quality (1 - 100; 75 is default) Return: 0 if OK, 1 on error
Definition at line 154 of file webpio.c.
References ERROR_INT, fopenWriteStream(), NULL, pixWriteStreamWebP(), and PROCNAME.
pixWriteStreampWebP()
Input: stream pix (all depths) quality (1 - 100; 75 is default) Return: 0 if OK, 1 on error
Notes: (1) webp only encodes rgb images, so the input image is converted to rgb if necessary.
Definition at line 193 of file webpio.c.
References ERROR_INT, NULL, pixConvertTo32(), pixDestroy(), pixEndianByteSwapNew(), pixGetData(), pixGetDepth(), pixGetDimensions(), pixGetWpl(), pixRemoveColormap(), L_WShed::pixt, PROCNAME, and REMOVE_CMAP_TO_FULL_COLOR.
Referenced by pixWriteStream(), and pixWriteWebP().
l_int32 pixWriteWebPwithTargetPSNR | ( | const char * | filename, |
PIX * | pixs, | ||
l_float64 | target_psnr, | ||
l_int32 * | pquality | ||
) |
Input: filename pix (all depths) target_psnr (target psnr to control the quality [1 ... 100]) pquality (<optional return>=""> final quality value used to obtain the target_psnr; can be null) Return: 0 if OK, 1 on error
Notes: (1) The parameter to control quality while encoding WebP is quality. This function does a line search over the quality values between MIN_QUALITY and MAX_QUALITY to achieve the target PSNR as close as possible.
Definition at line 275 of file webpio.c.
References ERROR_INT, fopenWriteStream(), L_MAX, L_MIN, NULL, pixConvertTo32(), pixDestroy(), pixGetData(), pixGetDepth(), pixGetDimensions(), pixGetWpl(), pixRemoveColormap(), PROCNAME, and REMOVE_CMAP_TO_FULL_COLOR.