1

I'd like a minimal library that'll allow me to read/write/manipulate raster image formats, like BMP and PNG.

Written in C99 or C11 or otherwise portable.

Any recommendations?

Edit I need to:

  • load bmp
  • get bmp information like width, data, depth, etc
  • access the BMP matrix data itself
  • preferably dither down to 1 bit per pixel
  • preferably save result to a file

Edit

Cross-platform for windows and linux (and android). The purpose is to read BMP (or PNG) data, maybe manipulate it (dither and horizontal padding - can be done later), and then push the data onto thermal printers using ESC/POS.

12
  • Which kind of manipulation you need?
    – convert
    Jan 8, 2022 at 13:37
  • @convert e.g. dither a BMP so the resulting matrix is 1 bit per pixel. I've been looking at stb, clibs and CCAN and getting kinda lost, some "reviews" would come in handy.
    – vesperto
    Jan 8, 2022 at 23:51
  • Gues you meaned Cimg from that stb link? The only library I know, which could do suc things, is OpenCV, but don´t think it can be called minimal.
    – convert
    Jan 9, 2022 at 12:12
  • Or did you meand by minimal, that it limited to raster stuf only?
    – convert
    Jan 9, 2022 at 12:17
  • @convert something along the lines of qdbmp i guess.
    – vesperto
    Jan 10, 2022 at 13:08

1 Answer 1

0

Two free software candidates would be:

  • Imlib2 - image loading and rendering (however, no longer maintained)
  • ImageMagick, versatile image processor, with command-line interface and various APIs - the C API is MagickWand
2
  • lmlib2 seems to be linux-only, magickwand seems to have way more features than i need.
    – vesperto
    Jan 10, 2022 at 14:49
  • 1
    @vesperto Since it´s open sorce, should be not really a problem to use it on diferent OS, like Windows. But as far I can see it is not minimal library.
    – convert
    Jan 10, 2022 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.