Image-PNG-FileConvert
view release on metacpan or search on metacpan
lib/Image/PNG/FileConvert.pod view on Meta::CPAN
This module is very simplistic, and should be considered an example of
the use of L<Image::PNG::Libpng>. If you need to do more complex
things than this module provides, please consider reading the source
code of this module as a starting point for making your own functions.
=head1 FUNCTIONS
=head2 file2png
file2png ('myfile.txt', 'myfile.png');
Convert C<myfile.txt> into a PNG graphic. The function uses the data
from myfile.txt to write a greyscale (black and white) image. The
bytes of the file correspond to the pixels of the image.
When this PNG is unwrapped using L</png2file>, it will be called
C<myfile.txt> again. If you want to specify a different name,
file2png ('myfile.txt', 'myfile.png',
{ name => 'not-the-same-name.txt' });
and the file will be unwrapped into C<not-the-same-name.txt>.
If you want your PNG to have a different width than the default, there
is another option, C<row_length>, specified in the same way:
file2png ('myfile.txt', 'myfile.png', { row_length => 0x100 });
The number you specify for C<row_length> will be the width of the
image in pixels. If this is not specified, the row length is given by
C<default_row_length> in the module, which is 2048
as of version 0.10 of this module.
=head2 png2file
png2file ('myfile.png');
Convert C<myfile.png> into a data file. C<myfile.png> must be a PNG
created using L</file2png>. The file is stored in whatever the name of
the file given to L</file2png> was.
This only converts PNG files output by L</file2png>, not general PNG
files. L</file2png> uses the text segment of the PNG image to store
the name and number of bytes of the original data, and without that
the data cannot be recovered.
An option "name" overrides the file name used in the input:
file2png ('file.png', name => 'another-name.txt');
=head1 SEE ALSO
For more information about the PNG format itself, see
L<Image::PNG::Libpng/SEE ALSO>.
Other CPAN modules with a similar function to Image::PNG::FileConvert include
=over
=item Acme::Steganography::Image::Png
L<Acme::Steganography::Image::Png> hides data in a PNG image.
=item Image::PNG::Write::BW
L<Image::PNG::Write::BW> creates minimal black and white PNG files
from user data.
=back
=head1 DEPENDENCIES
=over
=item Image::PNG::Libpng
L<Image::PNG::Libpng> is used for all the PNG reading and writing
functions.
=item Carp
L<Carp> is used to report errors.
=back
=head1 SCRIPTS
The distribution also includes two utility scripts, file2png and
png2file, which convert a file to a PNG image and back again.
=head1 AUTHOR
Ben Bullock, <bkb@cpan.org>
=head1 COPYRIGHT & LICENCE
This package and associated files are copyright (C)
2011-2017
Ben Bullock.
You can use, copy, modify and redistribute this package and associated
files under the Perl Artistic Licence or the GNU General Public
Licence.
( run in 0.972 second using v1.01-cache-2.11-cpan-39bf76dae61 )