imageformats 5.1.0

Decoders for PNG, TGA, BMP, JPEG and encoders for PNG, TGA. No deps.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

imageformats Build Status

  • returned image data is always 8-bit (Y/YA/RGB/RGBA)
FormatDecoderEncoder
png8-bit8-bit non-paletted non-interlaced
tga8-bit non-paletted8-bit non-paletted
bmp8-bit8-bit uncompressed
jpegbaselinenope
import imageformats;

void main() {
    // optional last argument defines conversion
    IFImage im = read_image("peruna.png");
    IFImage im2 = read_image("peruna.png", ColFmt.YA);
    IFImage im3 = read_image("peruna.png", ColFmt.RGB);

    write_image("peruna.tga", im.w, im.h, im.pixels);
    write_image("peruna.tga", im.w, im.h, im.pixels, ColFmt.RGBA);

    // get basic info without decoding
    long w, h, chans;
    read_image_info("peruna.png", w, h, chans);

    // there are also format specific functions
    PNG_Header hdr = read_png_header("peruna.png"); // get detailed info
    IFImage im4 = read_jpeg("porkkana.jpg");
    write_tga("porkkana.tga", im4.w, im4.h, im4.pixels);
}
Authors:
  • Tero Hänninen
Dependencies:
none
Versions:
7.0.2 2019-Oct-10
7.0.1 2019-Jul-12
7.0.0 2018-Apr-14
6.1.3 2018-Mar-29
6.1.2 2017-Oct-31
Show all 28 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 5 downloads this month

  • 53148 downloads total

Score:
2.2
Short URL:
imageformats.dub.pm