Import std.image.png
std.image.png
PNG, and APNG, its animation: Png.Decode reads any PNG, of every color type and bit depth, interlaced or not, as stb_image reads them, and Encode writes one, 8 bits a channel, RGB when every pixel is opaque and RGBA when one isn't, deflated by zlib-ng at a level. DecodeAnimation reads an APNG's frames, each as it's shown, or a PNG's one, and EncodeAnimation writes one.
std/image/png.fb
Types
Png
struct
Public Struct Png
What reads and writes PNG images and animations, in its Static Methods.
-
@PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): Image Throws IOErrorstatic method #The image in
data, which is a PNG, or an APNG's image for decoders without animation. Throws an IOError of INVALID_DATA when thedataisn't a PNG or is broken, and OTHER when the image has more pixels thanlimit. Panics when thelimitis negative. -
The PNG of the
image, deflated atlevel, from 0 to 9. Panics when thelevelis another, or theimagehas no pixels or more than 268435456, as many as stb_image reads back. -
@PanicsAtCaller Public Static Method DecodeAnimation(data: UInt8[], limit: Int = MOST_PIXELS): Animation Throws IOErrorstatic method #An APNG's frames, each as it's shown once the frames before it are, or a PNG's one, which plays once. Throws an IOError as Decode does, of OTHER when the frames, all their pixels counted, have more than
limit. Panics when thelimitis negative. -
@PanicsAtCaller Public Static Method EncodeAnimation(animation: Animation, level: Int = 6): UInt8[]static method #The APNG of the
animation's frames, each deflated atlevel, from 0 to 9, whose first frame is the image a decoder withoutanimationshows: each delay in milliseconds up to 65535, in hundredths of a second, rounded, up to 655350, and in seconds past that. Panics when thelevelis another, or theanimationhas no frames, no pixels or more than 268435456, or a frame whose image isn't its size.
Report an issue with this page or with FutureBlitz on GitHub.