简体   繁体   中英

How can I read/write an image in C++ using just boost/standard library?

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

Thanks!

Boost.GIL有一个很好的视频教程 ,向您展示如何以非常通用但高效的方式读/写和处理原始图像数据。

I suggest CImg . This library is extremely easy to use. You only have to include a header file in your code and set some parameters when compiling and that's it! I've used CImg with MingW and GCC.

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

Boost seems to include some sort of image access library known as Boost.GIL . I really don't know much about it, though.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM