Image-Leptonica

 view release on metacpan or  search on metacpan

lib/Image/Leptonica/Func/jpegio.pm  view on Meta::CPAN


      Input:  filename
              pix
              quality (1 - 100; 75 is default)
              progressive (0 for baseline sequential; 1 for progressive)
      Return: 0 if OK; 1 on error

=head2 pixWriteMemJpeg

l_int32 pixWriteMemJpeg ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 quality, l_int32 progressive )

  pixWriteMemJpeg()

      Input:  &data (<return> data of jpeg compressed image)
              &size (<return> size of returned data)
              pix
              quality  (1 - 100; 75 is default value; 0 is also default)
              progressive (0 for baseline sequential; 1 for progressive)
      Return: 0 if OK, 1 on error

  Notes:
      (1) See pixWriteStreamJpeg() for usage.  This version writes to
          memory instead of to a file stream.

=head2 pixWriteStreamJpeg

l_int32 pixWriteStreamJpeg ( FILE *fp, PIX *pix, l_int32 quality, l_int32 progressive )

  pixWriteStreamJpeg()

      Input:  stream
              pix  (8 or 32 bpp)
              quality  (1 - 100; 75 is default value; 0 is also default)
              progressive (0 for baseline sequential; 1 for progressive)
      Return: 0 if OK, 1 on error

  Notes:
      (1) Under the covers, the library transforms rgb to a
          luminence-chromaticity triple, each component of which is
          also 8 bits, and compresses that.  It uses 2 Huffman tables,
          a higher resolution one (with more quantization levels)
          for luminosity and a lower resolution one for the chromas.
      (2) Progressive encoding gives better compression, at the
          expense of slower encoding and decoding.
      (3) Standard chroma subsampling is 2x2 on both the U and V
          channels.  For highest quality, use no subsampling; this
          option is set by pixSetChromaSampling(pix, 0).
      (4) There are three possibilities:
          * Grayscale image, no colormap: compress as 8 bpp image.
          * rgb full color image: copy each line into the color
            line buffer, and compress as three 8 bpp images.
          * 8 bpp colormapped image: convert each line to three
            8 bpp line images in the color line buffer, and
            compress as three 8 bpp images.
      (5) The only valid pixel depths in leptonica are 1, 2, 4, 8, 16
          and 32 bpp.  However, it is possible, and in some cases desirable,
          to write out a jpeg file using an rgb pix that has 24 bpp.
          This can be created by appending the raster data for a 24 bpp
          image (with proper scanline padding) directly to a 24 bpp
          pix that was created without a data array.  See note in
          pixWriteStreamPng() for an example.

=head2 readHeaderJpeg

l_int32 readHeaderJpeg ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk )

  readHeaderJpeg()

      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

Zakariyya Mughal <zmughal@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Zakariyya Mughal.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.693 second using v1.01-cache-2.11-cpan-aadc1410aed )