textures, overlay images, libimago
[demo_prior] / libs / imago2 / README.md
1 libimago
2 ========
3
4 Overview
5 --------
6 Imago is a simple C library for reading and writing images in many different
7 image file formats.
8
9 Currently supported file formats:
10  * PNG (requires libpng).
11  * JPEG (requires libjpeg).
12  * Targa: 24bit or 32bit, raw, or RLE compressed.
13  * Portable PixMap (PPM), and Portable GreyMap (PGM).
14  * Radiance shared exponent HDR (RGBE).
15  * LBM: InterLeaved BitMap (ILBM), and Planar BitMap (PBM).
16
17 License
18 -------
19 Copyright (C) 2010-2019 John Tsiombikas <nuclear@member.fsf.org>
20
21 You may freely use, modify and/or redistribute libimago, under the terms of the
22 GNU Lesser General Public License (LGPL) version 3 (or at your option, any
23 later version published by the Free Software Foundation). See `COPYING` and
24 `COPYING.LESSER` for details.
25
26 Download
27 --------
28 Latest release: http://nuclear.mutantstargoat.com/sw/libimago/files/libimago-2.2.tar.gz
29
30 Grab the source code from github: https://github.com/jtsiomb/libimago
31
32 Web site: http://nuclear.mutantstargoat.com/sw/libimago
33
34 Usage example
35 -------------
36
37 Check out the example program under `test/`, and the *heavily*
38 commented `imago2.h` header file, to find out how to use libimago.
39
40 The simplest way to load image data in RGBA 32bit is:
41
42     int width, height;
43     unsigned char *pixels = img_load_pixels("foo.png", &width, &height, IMG_FMT_RGBA32);
44     img_free_pixels(pixels);
45
46 To load image data in the closest possible format to whatever is natively
47 stored in each particular image file, use:
48
49     struct img_pixmap img;
50     img_init(&img);
51     img_load(&img, "foo.png");
52     /* use img.fmt to determine the actual pixel format we got */
53     img_destroy(&img);
54
55 There's also an optional interface for loading an image and creating an OpenGL
56 texture out of it in a single call:
57
58     unsigned int texture = img_gltexture_load("foo.png");
59
60 Build
61 -----
62 To build and install `imago2` on UNIX run:
63
64     ./configure
65     make
66     make install
67
68 If you wish to avoid the `libpng` or `libjpeg` dependencies, you may disable
69 support for these formats by passing `--disable-png` or `--disable-jpeg` to
70 `configure`.
71
72 To build on windows just use msys2/mingw32 and follow the UNIX instructions.
73
74 To cross-compile for windows with mingw-w64, try the following incantation:
75
76     ./configure --prefix=/usr/i686-w64-mingw32
77     make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar sys=MINGW32
78     make install sys=MINGW32