loadPNG - multiple declarations

Function loadPNG

Load PNG from file using local FileSystem. Causes GC allocation

SuperImage loadPNG (
  string filename
);

Function loadPNG

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

SuperImage loadPNG (
  InputStream istrm
);

Example

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");

Function loadPNG

Load PNG from stream using specified image factory. GC-free

Compound!(dlib.image.image.SuperImage,string) loadPNG (
  InputStream istrm,
  SuperImageFactory imgFac
);