libpel
A C library that draws shapes and text on PNG, JPEG and WebP images.
What it does
libpel (Photo Editing Library) is a C library that draws on images. It reads and writes PNG, JPEG and WebP. I started it for a school project.
It can draw:
- Lines.
- Circles, rectangles and triangles, as outlines or filled.
- Text boxes, with FreeType.
It also has a grayscale filter.
The API
The library keeps one internal handle for the current image. You set the source and the destination, start the image, draw, and save. Each function returns an error code, and pel_strerrno() gives the message.
if (pel_set_src_dest("circle.png", "circle.png")) return err();
if (pel_init(100, 100)) return err();
if (pel_draw_circle(PEL_COLOR_WHITE, PEL_CORD(10, 10), 15)) return err();
if (pel_save()) return err();
The install script builds the library and adds a pkgconf file. Other projects can then link it with pkgconf pel --libs --cflags.
elconf uses libpel to draw its images.