Skip to content
FutureBlitz

    Install

    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.

    std/image/png.fb, line 12

    • @PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): Image Throws IOError static 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 the data isn't a PNG or is broken, and OTHER when the image has more pixels than limit. Panics when the limit is negative.

    • @PanicsAtCaller Public Static Method Encode(image: Image, level: Int = 6): UInt8[] static method #

      The PNG of the image, deflated at level, from 0 to 9. Panics when the level is another, or the image has 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 IOError static 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 the limit is negative.

    • @PanicsAtCaller Public Static Method EncodeAnimation(animation: Animation, level: Int = 6): UInt8[] static method #

      The APNG of the animation's frames, each deflated at level, from 0 to 9, whose first frame is the image a decoder without animation shows: each delay in milliseconds up to 65535, in hundredths of a second, rounded, up to 655350, and in seconds past that. Panics when the level is another, or the animation has 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.