0
A
回答
1
对于Windows和C++,最简单的方法是Gdiplus。这里有一些伪代码。
Gdiplus::Bitmap* pBmp = new Gdiplus::Bitmap(width, height, pixelformat);
pBmp->SetPalette(...); // initialize palette for 8bpp formats and less
pBmp->LockBits(...); // acquire the bitmap buffer
// copy your binary image data into the buffer
pBmp->UnlockBits(...); // return the buffer
pBmp->Save(filename, &clsidBMP, NULL);
delete pBmp;
您可以得到由GDI定义的像素格式列表加上here。
您需要的大部分内容由Bitmap类定义,该类继承自Image类,该类定义了Save方法。
“保存”方法所需的编码器clsid有点棘手。但请参阅我的帖子here了解如何获取此值。
0
ATL::CImage* image_ = new CImage();
image_ -> Create(rect.right - rect.left, rect.bottom - rect.top, 32);
...
image_ -> Save(filename);
delete image_;
相应地更改为Create()中的参数。
0
How to save bitmap to file?如果你可以在阅读 Bitmap types - MSDN之后对此代码进行一些调整,它应该可以工作!
相关问题
- 1. 32 bpp单色位图1 bpp TIFF
- 2. 16 bpp到32 bpp转换
- 3. 打开pgm图像16 bpp
- 4. 从24 bpp到16 bpp格式的图像转换
- 5. 在位图图像中更改BPP
- 6. 了解DICOM图像中的BPP
- 7. 如何将.net 4中的位图图片/图像转换为1 bpp位图图像?
- 8. 如何解释在1 BPP BMP文件的像素阵列
- 9. 试图为多个BPP格式创建保存位图funcion
- 10. 如何从1,2,4 bpp图像访问像素?
- 11. 如何压缩压缩率为4 bpp或更低的jpeg图像?
- 12. GstBuffer像素类型(确定BPP)
- 13. BPP颜色改变SDL
- 14. 将DXGI_FORMAT转换为bpp
- 15. 如何避免CGDisplayModeCopyPixelEncoding获得BPP?
- 16. 在.net紧凑框架中将图像转换为1 bpp位图
- 17. 如何在C#中将32bpp图像转换为16 bpp图像? (灰度)
- 18. 8bpp图像太暗
- 19. 如何防止VS设置为32ARGB从8 bpp原始图像的位图
- 20. 验证从24 BPP图像特定颜色在C#
- 21. 为什么在这个.bmp图像中0x1C的bpp信息是错误的?
- 22. 是否有可能使24 bpp和没有alpha通道的NSBitmapImageRep?
- 23. 如何将单色xbm位图数据转换为1通道8bpp图像?
- 24. 从图像格式创建BufferedImage 8BPP
- 25. Laravel 4上传1图像并保存为多个(3)
- 26. OpenCV imread 8BPP PNG图像错误
- 27. 如何保存或下载PrimeNg图表图像 - Angular 4
- 28. 如何翻转和保存图像
- 29. 如何将图像保存为图像
- 30. 如何保存图像