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. 如何保存圖像