Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C Image Library [closed]

Can anyone recommend a decent C image library?

I'm after loaders for bmp, gif, jpg, png and tga.

I want to use this for programming my Sony Playstation Portable, so opensource would be very handy.

After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.

like image 458
thing2k Avatar asked Sep 08 '08 16:09

thing2k


People also ask

Can we add image in C program?

PGM stands for Portable Gray Map. Saving a 2D array in C as images in PNG, JPG or other formats would need a lot of effort to encode the data in the specified format before writing to a file. However, Netpbm format offers a simple solution with easy portability.

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/ ).


2 Answers

If you control the images you're loading, the lightest loader I know is Sean Barrett's awesome stb_image.c (direct link to single file source code!).

There are also other very worthwhile libraries on Sean's site such as a tiny TrueType rasterizer and Vorbis decompressor, btw.

If you need OpenGL image loading that uses stb_image, I'll humbly point you to SOILex...

like image 144
AKX Avatar answered Oct 14 '22 16:10

AKX


ImageMagick has a C API to connect to its libraries. There's also what they call a "low-level interface" between C and the ImageMagick libraries.

like image 45
Thomas Owens Avatar answered Oct 14 '22 15:10

Thomas Owens