view release on metacpan or search on metacpan
lib/Image/Leptonica/Func/bmpio.pm view on Meta::CPAN
On systems like windows without fmemopen() and open_memstream(),
we write data to a temp file and read it back for operations
between pix and compressed-data, such as pixReadMemPng() and
pixWriteMemPng().
=head1 FUNCTIONS
=head2 pixReadMemBmp
PIX * pixReadMemBmp ( const l_uint8 *cdata, size_t size )
pixReadMemBmp()
Input: cdata (const; bmp-encoded)
size (of data)
Return: pix, or null on error
Notes:
(1) The @size byte of @data must be a null character.
=head2 pixReadStreamBmp
PIX * pixReadStreamBmp ( FILE *fp )
lib/Image/Leptonica/Func/gifio.pm view on Meta::CPAN
- valgrind detects uninitialized values used used for writing
and conditionally jumping in EGifPutScreenDesc().
- DGifSlurp() crashes on some images, apparently triggered by
by some GIF extension records. The latter problem has been
reported but not resolved as of October 2013.
=head1 FUNCTIONS
=head2 pixReadMemGif
PIX * pixReadMemGif ( const l_uint8 *cdata, size_t size )
pixReadMemGif()
Input: data (const; gif-encoded)
size (of data)
Return: pix, or null on error
Notes:
(1) Of course, we are cheating here -- writing the data to file
in gif format and reading it back in. We can't use the
lib/Image/Leptonica/Func/jpegio.pm view on Meta::CPAN
jpeg library to create an 8 bpp palette image, or to
tell if the jpeg data has been corrupted. For corrupt jpeg
data, there are two possible outcomes:
(1) a damaged pix will be returned, along with a nonzero
number of warnings, or
(2) for sufficiently serious problems, the library will attempt
to exit (caught by our error handler) and no pix will be returned.
=head2 pixReadMemJpeg
PIX * pixReadMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint )
pixReadMemJpeg()
Input: cdata (const; jpeg-encoded)
size (of data)
colormap flag (0 means return RGB image if color;
1 means create colormap and return 8 bpp
palette image if color)
reduction (scaling factor: 1, 2, 4 or 8)
&nwarn (<optional return> number of warnings)
hint (bitwise OR of L_HINT_* values; use 0 for no hint)
Return: pix, or null on error
Notes:
lib/Image/Leptonica/Func/jpegio.pm view on Meta::CPAN
Input: filename
&w (<optional return>)
&h (<optional return>)
&spp (<optional return>, samples/pixel)
&ycck (<optional return>, 1 if ycck color space; 0 otherwise)
&cmyk (<optional return>, 1 if cmyk color space; 0 otherwise)
Return: 0 if OK, 1 on error
=head2 readHeaderMemJpeg
l_int32 readHeaderMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk )
readHeaderMemJpeg()
Input: cdata (const; jpeg-encoded)
size (of data)
&w (<optional return>)
&h (<optional return>)
&spp (<optional return>, samples/pixel)
&ycck (<optional return>, 1 if ycck color space; 0 otherwise)
&cmyk (<optional return>, 1 if cmyk color space; 0 otherwise)
Return: 0 if OK, 1 on error
=head1 AUTHOR
lib/Image/Leptonica/Func/pngio.pm view on Meta::CPAN
void l_pngSetReadStrip16To8 ( l_int32 flag )
l_pngSetReadStrip16To8()
Input: flag (1 for stripping 16 bpp to 8 bpp on reading;
0 for leaving 16 bpp)
Return: void
=head2 pixReadMemPng
PIX * pixReadMemPng ( const l_uint8 *cdata, size_t size )
pixReadMemPng()
Input: cdata (const; png-encoded)
size (of data)
Return: pix, or null on error
Notes:
(1) The @size byte of @data must be a null character.
=head2 pixReadStreamPng
PIX * pixReadStreamPng ( FILE *fp )
lib/Image/Leptonica/Func/pnmio.pm view on Meta::CPAN
&w (<optional return>)
&h (<optional return>)
&d (<optional return>)
&type (<optional return> pnm type)
&bps (<optional return>, bits/sample)
&spp (<optional return>, samples/pixel)
Return: 0 if OK, 1 on error
=head2 pixReadMemPnm
PIX * pixReadMemPnm ( const l_uint8 *cdata, size_t size )
pixReadMemPnm()
Input: cdata (const; pnm-encoded)
size (of data)
Return: pix, or null on error
Notes:
(1) The @size byte of @data must be a null character.
=head2 pixReadStreamPnm
PIX * pixReadStreamPnm ( FILE *fp )
lib/Image/Leptonica/Func/pnmio.pm view on Meta::CPAN
&w (<optional return>)
&h (<optional return>)
&d (<optional return>)
&type (<optional return> pnm type)
&bps (<optional return>, bits/sample)
&spp (<optional return>, samples/pixel)
Return: 0 if OK, 1 on error
=head2 sreadHeaderPnm
l_int32 sreadHeaderPnm ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp )
sreadHeaderPnm()
Input: cdata (const; pnm-encoded)
size (of data)
&w (<optional return>)
&h (<optional return>)
&d (<optional return>)
&type (<optional return> pnm type)
&bps (<optional return>, bits/sample)
&spp (<optional return>, samples/pixel)
Return: 0 if OK, 1 on error
=head1 AUTHOR
lib/Image/Leptonica/Func/spixio.pm view on Meta::CPAN
Notes:
(1) This does a fast serialization of the principal elements
of the pix, as follows:
"spix" (4 bytes) -- ID for file type
w (4 bytes)
h (4 bytes)
d (4 bytes)
wpl (4 bytes)
ncolors (4 bytes) -- in colormap; 0 if there is no colormap
cdata (4 * ncolors) -- size of serialized colormap array
rdatasize (4 bytes) -- size of serialized raster data
= 4 * wpl * h
rdata (rdatasize)
=head2 pixWriteMemSpix
l_int32 pixWriteMemSpix ( l_uint8 **pdata, size_t *psize, PIX *pix )
pixWriteMemSpix()
lib/Image/Leptonica/Func/tiffio.pm view on Meta::CPAN
Input: stream (opened for read)
&xres, &yres (<return> resolution in ppi)
Return: 0 if OK; 1 on error
Notes:
(1) If neither resolution field is set, this is not an error;
the returned resolution values are 0 (designating 'unknown').
=head2 pixReadMemTiff
PIX * pixReadMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n )
pixReadMemTiff()
Input: data (const; tiff-encoded)
datasize (size of data)
n (page image number: 0-based)
Return: pix, or null on error
Notes:
(1) This is a version of pixReadTiff(), where the data is read
lib/Image/Leptonica/Func/tiffio.pm view on Meta::CPAN
PIXA * pixaReadMultipageTiff ( const char *filename )
pixaReadMultipageTiff()
Input: filename (input tiff file)
Return: pixa (of page images), or null on error
=head2 readHeaderMemTiff
l_int32 readHeaderMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat )
readHeaderMemTiff()
Input: cdata (const; tiff-encoded)
size (size of data)
n (page image number: 0-based)
&width (<return>)
&height (<return>)
&bps (<return> bits per sample -- 1, 2, 4 or 8)
&spp (<return>; samples per pixel -- 1 or 3)
&res (<optional return>; resolution in x dir; NULL to ignore)
&cmap (<optional return>; colormap exists; input NULL to ignore)
&format (<optional return>; tiff format; input NULL to ignore)
Return: 0 if OK, 1 on error
lib/Image/Leptonica/Func/webpio.pm view on Meta::CPAN
PIX * pixReadStreamWebP ( FILE *fp )
pixReadStreamWebP()
Input: stream corresponding to WebP image
Return: pix (32 bpp), or null on error
=head2 pixWriteMemWebP
l_int32 pixWriteMemWebP ( l_uint8 **pencdata, size_t *pencsize, PIX *pixs, l_int32 quality, l_int32 lossless )
pixWriteMemWebP()
Input: &encdata (<return> webp encoded data of pixs)
&encsize (<return> size of webp encoded data)
pixs (any depth, cmapped OK)
quality (0 - 100; default ~80)
lossless (use 1 for lossless; 0 for lossy)
Return: 0 if OK, 1 on error
Notes:
(1) Lossless and lossy encoding are entirely different in webp.
@quality applies to lossy, and is ignored for lossless.
(2) The input image is converted to RGB if necessary. If spp == 3,
lib/Image/Leptonica/leptonica.h view on Meta::CPAN
extern L_BMF * bmfCreate ( const char *dir, l_int32 size );
extern void bmfDestroy ( L_BMF **pbmf );
extern PIX * bmfGetPix ( L_BMF *bmf, char chr );
extern l_int32 bmfGetWidth ( L_BMF *bmf, char chr, l_int32 *pw );
extern l_int32 bmfGetBaseline ( L_BMF *bmf, char chr, l_int32 *pbaseline );
extern PIXA * pixaGetFont ( const char *dir, l_int32 size, l_int32 *pbl0, l_int32 *pbl1, l_int32 *pbl2 );
extern l_int32 pixaSaveFont ( const char *indir, const char *outdir, l_int32 size );
extern PIXA * pixaGenerateFont ( const char *dir, l_int32 size, l_int32 *pbl0, l_int32 *pbl1, l_int32 *pbl2 );
extern PIX * pixReadStreamBmp ( FILE *fp );
extern l_int32 pixWriteStreamBmp ( FILE *fp, PIX *pix );
extern PIX * pixReadMemBmp ( const l_uint8 *cdata, size_t size );
extern l_int32 pixWriteMemBmp ( l_uint8 **pdata, size_t *psize, PIX *pix );
extern BOX * boxCreate ( l_int32 x, l_int32 y, l_int32 w, l_int32 h );
extern BOX * boxCreateValid ( l_int32 x, l_int32 y, l_int32 w, l_int32 h );
extern BOX * boxCopy ( BOX *box );
extern BOX * boxClone ( BOX *box );
extern void boxDestroy ( BOX **pbox );
extern l_int32 boxGetGeometry ( BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph );
extern l_int32 boxSetGeometry ( BOX *box, l_int32 x, l_int32 y, l_int32 w, l_int32 h );
extern l_int32 boxGetSideLocation ( BOX *box, l_int32 side, l_int32 *ploc );
extern l_int32 boxGetRefcount ( BOX *box );
lib/Image/Leptonica/leptonica.h view on Meta::CPAN
extern FPIX * fpixFlipTB ( FPIX *fpixd, FPIX *fpixs );
extern FPIX * fpixAffinePta ( FPIX *fpixs, PTA *ptad, PTA *ptas, l_int32 border, l_float32 inval );
extern FPIX * fpixAffine ( FPIX *fpixs, l_float32 *vc, l_float32 inval );
extern FPIX * fpixProjectivePta ( FPIX *fpixs, PTA *ptad, PTA *ptas, l_int32 border, l_float32 inval );
extern FPIX * fpixProjective ( FPIX *fpixs, l_float32 *vc, l_float32 inval );
extern l_int32 linearInterpolatePixelFloat ( l_float32 *datas, l_int32 w, l_int32 h, l_float32 x, l_float32 y, l_float32 inval, l_float32 *pval );
extern PIX * fpixThresholdToPix ( FPIX *fpix, l_float32 thresh );
extern FPIX * pixComponentFunction ( PIX *pix, l_float32 rnum, l_float32 gnum, l_float32 bnum, l_float32 rdenom, l_float32 gdenom, l_float32 bdenom );
extern PIX * pixReadStreamGif ( FILE *fp );
extern l_int32 pixWriteStreamGif ( FILE *fp, PIX *pix );
extern PIX * pixReadMemGif ( const l_uint8 *cdata, size_t size );
extern l_int32 pixWriteMemGif ( l_uint8 **pdata, size_t *psize, PIX *pix );
extern GPLOT * gplotCreate ( const char *rootname, l_int32 outformat, const char *title, const char *xlabel, const char *ylabel );
extern void gplotDestroy ( GPLOT **pgplot );
extern l_int32 gplotAddPlot ( GPLOT *gplot, NUMA *nax, NUMA *nay, l_int32 plotstyle, const char *plottitle );
extern l_int32 gplotSetScaling ( GPLOT *gplot, l_int32 scaling );
extern l_int32 gplotMakeOutput ( GPLOT *gplot );
extern l_int32 gplotGenCommandFile ( GPLOT *gplot );
extern l_int32 gplotGenDataFiles ( GPLOT *gplot );
extern l_int32 gplotSimple1 ( NUMA *na, l_int32 outformat, const char *outroot, const char *title );
extern l_int32 gplotSimple2 ( NUMA *na1, NUMA *na2, l_int32 outformat, const char *outroot, const char *title );
lib/Image/Leptonica/leptonica.h view on Meta::CPAN
extern PIX * pixReadStreamPng ( FILE *fp );
extern l_int32 readHeaderPng ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
extern l_int32 freadHeaderPng ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
extern l_int32 readHeaderMemPng ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap );
extern l_int32 fgetPngResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres );
extern l_int32 isPngInterlaced ( const char *filename, l_int32 *pinterlaced );
extern l_int32 pixWritePng ( const char *filename, PIX *pix, l_float32 gamma );
extern l_int32 pixWriteStreamPng ( FILE *fp, PIX *pix, l_float32 gamma );
extern l_int32 pixSetZlibCompression ( PIX *pix, l_int32 compval );
extern void l_pngSetReadStrip16To8 ( l_int32 flag );
extern PIX * pixReadMemPng ( const l_uint8 *cdata, size_t size );
extern l_int32 pixWriteMemPng ( l_uint8 **pdata, size_t *psize, PIX *pix, l_float32 gamma );
extern PIX * pixReadStreamPnm ( FILE *fp );
extern l_int32 readHeaderPnm ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp );
extern l_int32 freadHeaderPnm ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp );
extern l_int32 pixWriteStreamPnm ( FILE *fp, PIX *pix );
extern l_int32 pixWriteStreamAsciiPnm ( FILE *fp, PIX *pix );
extern PIX * pixReadMemPnm ( const l_uint8 *cdata, size_t size );
extern l_int32 readHeaderMemPnm ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pd, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp );
extern l_int32 pixWriteMemPnm ( l_uint8 **pdata, size_t *psize, PIX *pix );
extern PIX * pixProjectiveSampledPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor );
extern PIX * pixProjectiveSampled ( PIX *pixs, l_float32 *vc, l_int32 incolor );
extern PIX * pixProjectivePta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor );
extern PIX * pixProjective ( PIX *pixs, l_float32 *vc, l_int32 incolor );
extern PIX * pixProjectivePtaColor ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval );
extern PIX * pixProjectiveColor ( PIX *pixs, l_float32 *vc, l_uint32 colorval );
extern PIX * pixProjectivePtaGray ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval );
extern PIX * pixProjectiveGray ( PIX *pixs, l_float32 *vc, l_uint8 grayval );
extern PIX * pixProjectivePtaWithAlpha ( PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border );
lib/Image/Leptonica/leptonica.h view on Meta::CPAN
extern l_int32 pixWriteTiffCustom ( const char *filename, PIX *pix, l_int32 comptype, const char *modestring, NUMA *natags, SARRAY *savals, SARRAY *satypes, NUMA *nasizes );
extern l_int32 pixWriteStreamTiff ( FILE *fp, PIX *pix, l_int32 comptype );
extern PIXA * pixaReadMultipageTiff ( const char *filename );
extern l_int32 writeMultipageTiff ( const char *dirin, const char *substr, const char *fileout );
extern l_int32 writeMultipageTiffSA ( SARRAY *sa, const char *fileout );
extern l_int32 fprintTiffInfo ( FILE *fpout, const char *tiffile );
extern l_int32 tiffGetCount ( FILE *fp, l_int32 *pn );
extern l_int32 getTiffResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres );
extern l_int32 readHeaderTiff ( const char *filename, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat );
extern l_int32 freadHeaderTiff ( FILE *fp, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat );
extern l_int32 readHeaderMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat );
extern l_int32 findTiffCompression ( FILE *fp, l_int32 *pcomptype );
extern l_int32 extractG4DataFromFile ( const char *filein, l_uint8 **pdata, size_t *pnbytes, l_int32 *pw, l_int32 *ph, l_int32 *pminisblack );
extern PIX * pixReadMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n );
extern l_int32 pixWriteMemTiff ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 comptype );
extern l_int32 pixWriteMemTiffCustom ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 comptype, NUMA *natags, SARRAY *savals, SARRAY *satypes, NUMA *nasizes );
extern l_int32 setMsgSeverity ( l_int32 newsev );
extern l_int32 returnErrorInt ( const char *msg, const char *procname, l_int32 ival );
extern l_float32 returnErrorFloat ( const char *msg, const char *procname, l_float32 fval );
extern void * returnErrorPtr ( const char *msg, const char *procname, void *pval );
extern char * stringNew ( const char *src );
extern l_int32 stringCopy ( char *dest, const char *src, l_int32 n );
extern l_int32 stringLength ( const char *src, size_t size );
extern l_int32 stringCat ( char *dest, size_t size, const char *src );
lib/Image/Leptonica/leptonica.h view on Meta::CPAN
extern l_int32 wshedApply ( L_WSHED *wshed );
extern l_int32 wshedBasins ( L_WSHED *wshed, PIXA **ppixa, NUMA **pnalevels );
extern PIX * wshedRenderFill ( L_WSHED *wshed );
extern PIX * wshedRenderColors ( L_WSHED *wshed );
extern PIX * pixReadStreamWebP ( FILE *fp );
extern PIX * pixReadMemWebP ( const l_uint8 *filedata, size_t filesize );
extern l_int32 readHeaderWebP ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
extern l_int32 readHeaderMemWebP ( const l_uint8 *data, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp );
extern l_int32 pixWriteWebP ( const char *filename, PIX *pixs, l_int32 quality, l_int32 lossless );
extern l_int32 pixWriteStreamWebP ( FILE *fp, PIX *pixs, l_int32 quality, l_int32 lossless );
extern l_int32 pixWriteMemWebP ( l_uint8 **pencdata, size_t *pencsize, PIX *pixs, l_int32 quality, l_int32 lossless );
extern l_int32 pixaWriteFiles ( const char *rootname, PIXA *pixa, l_int32 format );
extern l_int32 pixWrite ( const char *filename, PIX *pix, l_int32 format );
extern l_int32 pixWriteStream ( FILE *fp, PIX *pix, l_int32 format );
extern l_int32 pixWriteImpliedFormat ( const char *filename, PIX *pix, l_int32 quality, l_int32 progressive );
extern l_int32 pixChooseOutputFormat ( PIX *pix );
extern l_int32 getImpliedFileFormat ( const char *filename );
extern const char * getFormatExtension ( l_int32 format );
extern l_int32 pixWriteMem ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 format );
extern l_int32 pixDisplay ( PIX *pixs, l_int32 x, l_int32 y );
extern l_int32 pixDisplayWithTitle ( PIX *pixs, l_int32 x, l_int32 y, const char *title, l_int32 dispflag );