How can I read / write an image in C ++ using only the extended / standard library?

Is it possible? It doesn’t matter in what format this image is, but I should be able to open it, read the pixel data into some kind of array, create a new image using a modified set of pixel data.

Thanks!

+4
source share
4 answers

Boost.GIL has a nice video tutorial that shows you how to read / write and process raw image data in a very universal but effective way.

+3
source

You need code to encode and decode the formats you want to support. You can do it yourself (not quite perfect / practical), you can implement encoding / decoding libraries (like libpng, for example), or you can embed image libraries like DevIL.

Boost seems to include some image access library known as Boost.GIL . I really don't know much about this.

0
source

I offer TARGA image format for your needs. You just read / write a few values ​​in the header, then the rest is an uncompressed array of RGBA pixel data. You don’t even need Boost!

0
source

I suggest CImg . This library is extremely easy to use. You need to include the header file in your code and set some parameters when compiling it too! I used CImg with MingW and GCC.

0
source

Source: https://habr.com/ru/post/1402131/


All Articles