The options argument may be a mapping containing zero or more encoding options:
The options argument may be a mapping containing zero or more encoding options:
normal options: "alpha":image object Use this image as alpha channel (Note: PNG alpha channel is grey. The values are calculated by (r+2g+b)/4.)"palette":colortable object Use this as palette for pseudocolor encoding (Note: encoding with alpha channel and pseudocolor at the same time are not supported)
Result is a mapping,
([ "image": object image,... options ... ])
image is the stored image.
Valid entries in options is a superset of the one given to encode:
basic options:"alpha": object alpha, - alpha channel
"palette": object colortable, - image palette (if non-truecolor)
advanced options:
"background": array(int) color, - suggested background color "background_index": int index, - what index in colortable
"chroma": ({ float white_point_x, float white_point_y, float red_x, float red_y, - CIE x,y chromaticities float green_x, float green_y, float blue_x, float blue_y })
"gamma": float gamma, - gamma
"spalette": object colortable, - suggested palette, for truecolor images "histogram": array(int) hist, - histogram for the image, corresponds to palette index
"physical": ({ int unit, - physical pixel dimension int x,y }) unit 0 means pixels/meter
"sbit": array(int) sbits - significant bits
"text": array(array(string)) text - text information, ({ ({ keyword, data }), ... })
Standard keywords:
Title Short (one line) title or caption for image Author Name of image's creator Description Description of image (possibly long) Copyright Copyright notice Creation Time Time of original image creation Software Software used to create the image Disclaimer Legal disclaimer Warning Warning of nature of content Source Device used to create the image Comment Miscellaneous comment
"time": ({ int year, month, day, - time of last modification hour, minute, second })
wizard options: "compression": int method - compression method (0)
This method can also take options, as a mapping:
advanced options: "palette": colortable object - replace the decoded palette with this when unpacking the image data, if applicable
Result is an array of arrays, ({ ({ string chunk_type, string data, int crc_ok }), ({ string chunk_type, string data, int crc_ok }) ... })
chunk_type is the type of the chunk, like "IHDR" or "IDAT".
data is the actual chunk data.
crcok is set to 1 if the checksum is ok and dontcheckcrc parameter isn't set.
Returns 0 if it isn't a PNG file.