The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Image::PNG::FileConvert - convert a file to or from a PNG image

SYNOPSIS

    use Image::PNG::FileConvert qw/file2png png2file/;
    # Convert a data file into a PNG image
    file2png ('myfile.txt', 'myfile.png');
    # Extract a data file from a PNG image
    png2file ('myfile.png');

FUNCTIONS

file2png

    file2png ('myfile.txt', 'myfile.png');

Convert 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 "png2file", it will be called 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 not-the-same-name.txt.

If you want your PNG to have a different width than the default, there is another option, row_length, specified in the same way:

    file2png ('myfile.txt', 'myfile.png', { row_length => 0x100 });

The number you specify for row_length will be the width of the image in pixels.

png2file

    png2file ('myfile.png');

Convert myfile.png into a data file. myfile.png must be a PNG created using "file2png". The file is stored in whatever the name of the file given to "file2png" was.

Please note that this only converts PNG files output by "file2png", not general PNG files.

BUGS

Holds file in memory

Both the routines here hold the entire file in memory, limiting the data size which can be converted to or from a PNG.

There should be a way to specify the output name in png2file

There should be some option to specify the name of the output file in "png2file".

AUTHOR

Ben Bullock, <bkb@cpan.org>

LICENCE

You can use, modify and distribute this software under the Perl Artistic Licence or the GNU General Public Licence.

SEE ALSO

Acme::Steganography::Image::Png

Acme::Steganography::Image::Png I'm not sure what this does, but maybe it does something similar to Image::PNG::FileConvert.

UTILITIES

The distribution also includes two utility scripts, file2png and png2file, which convert a file to a PNG image and back again.