This is an almost-pure Raku PNG module.
This module is currently useful for outputting 8-bit-per-channel truecolor images. Reading, precompression filters, palettes, grayscale, non-8-bit channels, and ancillary features like gamma correction, color profiles, and textual metadata are all NYI.
Range checks (UInt, UInt8, and PInt, mentioned below) are disabled pending a Rakudo bugfix. Violate them at your peril.
use Image::PNG::Portable;
my $o = Image::PNG::Portable.new: :width(16), :height(16);
$o.set: 8,8, 255,255,255;
$o.write: 'image.png';
The following types are used internally and in this documentation. They are here for brevity, not exported in the public API.
subset UInt of Int where * >= 0; # unsigned
subset UInt8 of Int where 0 <= * <= 255; # unsigned 8-bit
subset PInt of Int where * > 0; # positive
Creates a new Image::PNG::Portable object, initialized to black. If the alpha channel is enabled, it is initialized to transparent.
Sets the color of a pixel in the image.
Sets the color of all pixels in the image.
Gets the color of a pixel in the image as an array of channel values.
Writes the contents of the image to the specified file.
None known. Please report bugs at https://github.com/raydiak/Image-PNG-Portable/issues or to [email protected] .