如何将这个新的char **写入.bmp文件?

时间:2013-11-02 02:41:17

标签: c++ graphics bitmap

如何将char**转换为bitmap? 我有图像width x height和字符矩阵3 * width x height(每个像素都表示为triplet of char red, char green, char blue)。我从另一个加载的位图填充了这个矩阵(我只需要原始位图的较小矩形,所以我填写了char**/matrix)。 如何将这个新的char**写入.bmp文件? 我尝试过 http://www.cplusplus.com/forum/beginner/12848/

但它有奇怪的行为。

1 个答案:

答案 0 :(得分:1)

一些可能的方向:

  1. 使用Microsoft API:CImage或CBitmap

  2. 使用现有库:http://code.google.com/p/libbmp/http://easybmp.sourceforge.net/http://sourceforge.net/projects/cimg/http://people.sc.fsu.edu/~jburkardt/cpp_src/bmp_io/bmp_io.html或ImageMagick(更多)

  3. 请勿使用库,请从此处开始:Writing BMP image in pure c/c++ without other libraries