Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple C image library? [closed]

What's the simplest C image library for loading and saving? I just want a 2D array to test some algorithms, and built-in functions are not needed.

like image 616
Timmy Avatar asked Apr 29 '10 20:04

Timmy


People also ask

Where can I find C library?

Libaries consist of a set of related functions to perform a common task; for example, the standard C library, 'libc. a', is automatically linked into your programs by the “gcc” compiler and can be found at /usr/lib/libc. a. Standard system libraries are usually found in /lib and /usr/lib/ directories.

What is a Cimg image?

cimg/base is an Ubuntu Docker image created by CircleCI with continuous integration builds in mind. As its name suggests, this image is designed to serve as a base image for other CircleCI Convenience Images (images prefixed with cimg/ ).

What is Stbi_load?

Image buffer Function stbi_load returns a pointer to an unsigned char* buffer. The size of this buffer is width * height * channels . The image data is stored in the buffer in row order, i.e., the first width * channels bytes belong to the first row of image.

Can you use libraries in C?

Functions in a C library can be used and accessed by programmers to create several different programs. As a programmer, you may find yourself using the same function or functions repeatedly. In this case, it is best to put this function or functions in a library to speed up the compilation of the program.


2 Answers

All these libraries are way too complicated for me. In your place I'd grit my teeth, define an abstraction for a dynamic two-dimensional array, and I'd read and write plain ASCII PNM format.

like image 66
Norman Ramsey Avatar answered Oct 21 '22 04:10

Norman Ramsey


You could try stb_image for reading and stb_image_write for writing. These are very small libraries.

http://nothings.org/
https://github.com/nothings/stb


Link to my question on gamedev I've got to know about this site:
https://gamedev.stackexchange.com/questions/9083/library-to-load-images-into-textures-linux-c-and-opengl

like image 35
Michas Avatar answered Oct 21 '22 04:10

Michas