Code Monkey home page Code Monkey logo

libimago's Introduction

libimago

Overview

Imago is a simple C library for reading and writing images in many different image file formats.

Currently supported file formats:
  • PNG (requires libpng).
  • JPEG (requires libjpeg).
  • Targa: 24bit or 32bit, raw, or RLE compressed.
  • Portable PixMap (PPM), and Portable GreyMap (PGM).
  • Radiance shared exponent HDR (RGBE).
  • LBM: InterLeaved BitMap (ILBM), and Planar BitMap (PBM).

License

Copyright (C) 2011-2017 John Tsiombikas <[email protected]>

You may freely use, modify and/or redistribute libimago, under the terms of the GNU Lesser General Public License (LGPL) version 3 (or at your option, any later version published by the Free Software Foundation). See COPYING and COPYING.LESSER for details.

Download

Latest release: http://nuclear.mutantstargoat.com/sw/libimago/files/libimago-2.1.tar.gz

Grab the source code from github: https://github.com/jtsiomb/libimago

Web site: http://nuclear.mutantstargoat.com/sw/libimago

Usage example

Check out the example program under test/, and the heavily commented imago2.h header file, to find out how to use libimago.

The simplest way to load image data in RGBA 32bit is:

int width, height;
unsigned char *pixels = img_load_pixels("foo.png", &width, &height, IMG_FMT_RGBA32);
img_free_pixels(pixels);

To load image data in the closest possible format to whatever is natively stored in each particular image file, use:

struct img_pixmap img;
img_init(&img);
img_load(&img, "foo.png");
/* use img.fmt to determine the actual pixel format we got */
img_destroy(&img);

There's also an optional interface for loading an image and creating an OpenGL texture out of it in a single call:

unsigned int texture = img_gltexture_load("foo.png");

Build

To build and install imago2 on UNIX run:

./configure
make
make install

If you wish to avoid the libpng or libjpeg dependencies, you may disable support for these formats by passing --disable-png or --disable-jpeg to configure.

To build on windows try to open the included visual studio project. For this to work you will have to download and build any dependencies (libpng, zlib, and libjpeg), point the visual studio include/library paths to the correct directories, and call the old ones from the deep.

If the build succeeds, a usr hierarchy will have been created in the project. Feel free to run install.bat to copy it to C:\usr, to try and impose some semblance of sanity to the system.

To cross-compile for windows with mingw-w64, try the following incantation:

./configure --prefix=/usr/i686-w64-mingw32
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar sys=MINGW32
make install sys=MINGW32

libimago's People

Contributors

jtsiomb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.