r/C_Programming • u/NoBrain8 • Jul 29 '26
Question How to find good libraries
I’m looking to convert a jpeg into rgba data + scale it down.
I’m looking for a library to help me do this - how do I find good a one?
3
Upvotes
4
u/Sergey5588 Jul 29 '26 edited Jul 29 '26
stb image
https://github.com/nothings/stb
4
u/mykesx Jul 29 '26
https://imagemagick.org/#gsc.tab=0
ImageMagick has command line tools to convert between formats and perform a large number of operations on images, including scaling.
If you want, you can convert jpeg to TGA, which is trivial to read in as RGB in C, do your own software operations on it, write TGA back to disk, then convert that however you want with the command line tools.
2
u/khalon23 Jul 29 '26
For jpeg decode + scale I would start with
stb_image+stb_image_resizeif you want a single-header drop-in, orlibjpeg-turboif you care about speed and a real package. Check license, last commit, and whether it has known CVEs for untrusted input.How I pick: does it do only the job I need, can I build it without a giant dependency tree, and is there a simple example that loads a file to RGBA. Avoid grabbing the first GitHub search hit with a flashy README and no tests.
1
u/primitiveblob Jul 29 '26
ffmpeg gives by far the most power/control for this
1
u/Syntax-Tactics Jul 29 '26
What platform? OS? Language?
WinAPI supports JPG loading out of the box, SDL2, OpenCV, stb_image. A quick google...
1
u/kansetsupanikku Jul 29 '26
openCV would be a respectable choice
0
u/Jaurusrex Jul 29 '26
You could use raylib, you'd need to compile it specifically with jpeg functionality. Or look at what raylib uses under the hood for library. That being said I doubt that library also has the capabilities to scale down the image, though depending on your algorithm scaling down an image is quite easy. You could just skip every X pixels