Skip to content

Latest commit

 

History

History
71 lines (36 loc) · 2.21 KB

README.md

File metadata and controls

71 lines (36 loc) · 2.21 KB

NAME

Image::PNG::Write::BW - Create minimal black-and-white PNG files.

VERSION

version 0.01

SYNOPSIS

This is a pure-perl module to encode a variety of raw black-and-white (1bpp) image representations into a minimal PNG file.

use Image::PNG::Write::BW qw( make_png_string );

my $data = make_png_string( [ "# ", " #" ] ); # Returns a 2x2 repeatalbe grid pattern.

EXPORT

make_png_string( \@lines )

Takes an arrayref of strings and turns them into a PNG. Whitespace characters are white, non-whitespace are black.

For example: make_png_string( [ "###", "# #", "###" ] ) will make a 3x3 box with a hole in the middle.

make_png_bitstream_array( \@scanlines, $width )

One bit per pixel, left-to-right on the image is high-bit to low-bit, lowest index to highest index. Each scanline passed as a seperate array element.

This currently copies each scanline.

make_png_bitstream_packed( $scanlines, $width, $height );

One bit per pixel, left-to-right on the image is high-bit to low-bit, lowest index to highest index. Each scanline starting on a byte boundary, with all scanlines packed into the same string.

This is the closest to the "native" PNG format.

This currently copies each scanline. If you have the ability to use the raw format ( prefix each line with \0 ), the make_png_bitstream_raw method may be more efficient.

make_png_bitstream_raw( $data, $width, $height );

This is the "native" format that PNG uses: One bit per pixel, left-to-right on the image is high-bit to low-bit, lowest index to highest index.

Each scanline starting on a byte boundary, with all scanlines packed into the same string.

Every scanline must be prefixed by the filter type (which should be \0, unless you know what you are doing.)

AUTHOR

Andrea Nall, <anall at cpan.org>

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Image::PNG::Write::BW

AUTHOR

Andrea Nall [email protected]

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Andrea Nall.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)