loadPNG

Load PNG from stream using default image factory. Causes GC allocation

Examples

import std.base64;

InputStream png() {
    string minimal =
        "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADklEQVR42mL4z8AAEGAAAwEBAGb9nyQAAAAASUVORK5CYII=";

    ubyte[] bytes = Base64.decode(minimal);
    return new ArrayStream(bytes, bytes.length);
}

SuperImage img = loadPNG(png());

assert(img.width == 1);
assert(img.height == 1);
assert(img.channels == 3);
assert(img.pixelSize == 3);
assert(img.data == [0xff, 0x00, 0x00]);

createDir("tests", false);
savePNG(img, "tests/minimal.png");
loadPNG("tests/minimal.png");

Meta