callumenator / imaged

Image loading routines
17 stars 7 forks source link

Routines for loading/decoding and writing/encoding images.

Implemented decoders:

Usage - loading from a file:

Image img = load("imagepath/imagefile.png");

Usage - loading from a stream:

Stream dataStream;
Decoder dcoder = getDecoder("imagepath/imagefile.png");
while(dcoder.parseStream(dataStream))
{
  do stuff, like draw the current interlaced png, fill the stream, etc.
} 

Implemented encoders:

Usage - writing out a PNG:

ubyte[] data = myImageData;  // note that it must be pixel interleaved for RGB/RGBA to work
Image myImg = new Img!(Px.R8G8B8)(width, height, data);
myImg.write("path/to/output.png");

Images:

Image myImg; 
myImg.resize(newWidth, newHeight, Image.ResizeAlgo.BILINEAR);

simpledisplay.d is from Adam Ruppe's repo: misc-stuff-including-D-programming-language-web-stuff.

Some details: