I’ve been looking all over the net for a good, quick solution to this, and haven’t found anything that has satisfied me yet. It seems like it should be trivial–just one or two calls to a function in some library and that’s it–but that doesn’t seem to be the case. libjpeg and libtiff lack good documentation and the solutions people have posted involve understanding how the image is produced and writing ~50 lines of code. How would you guys do this in C++?
Share
If you want “simple” over anything else, then have a look at stb_image_write.h.
This is a single header file, which includes support for writing BMP, PNG and TGA files. Just a single call for each format: