imageformats 3.0.5
Image formats: JPEG (no encoder), PNG, TGA. One file, no deps.
To use this package, put the following dependency into your project's dependencies section:
dub.json
dub.sdl
Image loading and saving
- returned image data is always 8-bit (Y/YA/RGB/RGBA)
- not optimal for 32-bit systems
| Format | Decoder | Encoder | | --- | --- | --- | | png | 8-bit | 8-bit non-paletted non-interlaced | | tga | 8-bit non-paletted | 8-bit non-paletted | | jpeg | baseline | nope |
Let me show you:
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);
}
- Registered by Tero Hänninen
- 3.0.5 released 4 years ago
- lgvz/imageformats
- BSL-1.0
- Authors:
- Dependencies:
- none
- Versions:
-
7.0.0 2018-Apr-14 6.1.3 2018-Mar-29 6.1.2 2017-Oct-31 6.1.1 2017-Jul-04 6.1.0 2016-Aug-29 - Download Stats:
-
-
87 downloads today
-
274 downloads this week
-
1246 downloads this month
-
34654 downloads total
-
- Score:
- 4.4
- Short URL:
- imageformats.dub.pm