如何储存转换为1bpp对Compact Framework的单色BMP文件的位图? [英] How store a bitmap converted to 1bpp to a monochrome bmp file on the Compact Framework?
问题描述
成功地转换为24位的位图转换为1比特位图后,我碰到问题,即当余存储该位图作为文件是24位再次,而不是1比特(单色)图像。
我需要它真的是一个1位的位图文件发送到蓝牙打印机。
这是如何做到这一点的任何想法或code-片段?
编辑:目前,我用下面的code保存位图:
System.Drawing.Bitmap.Save(路径\ FileName.bmp
System.Drawing.Imaging.ImageFormat.Bmp)
在网上我看到一对夫妇的方式来做到这一点的Compact Framework的:
- 在此相关的SO问题有关使用Compact Framework的节约1bpp,有另一种Win32 API的解决方案,可用于1bpp数据保存到磁盘上。
- <打击>加工使用的PixelFormat 枚举,但是这可能不是在Compact Framework的工作击>
- 在转换使用Win32 API ,的code彻底的解释和整个项目拉链可用。这应该工作在Compact Framework的,但我不是100%肯定所有的API是否可用那里。
我没有一个CF安装方便,否则我会一直张贴尝试过的解决方案。
After converting a 24-bit bitmap successfully into a 1-bit bitmap, I run into the problem that when I store the bitmap as file it is 24-bit again and not a 1-bit (monochrome) image.
I need it to really be a 1-bit bitmap file for sending it to a Bluetooth printer.
Any ideas or code-snippets on how to do this?
EDIT: Currently, I'm using the following code to save the bitmap:
System.Drawing.Bitmap.Save("Path\FileName.bmp",
System.Drawing.Imaging.ImageFormat.Bmp)
On the internet I see a couple of ways to do this on the Compact Framework:
- In this related SO question about saving 1bpp using Compact Framework, there's another Win32 API solution available for saving the 1bpp data to disk.
Converting using the PixelFormat enum, but this may not work on the Compact Framework.- Converting using Win32 API, thorough explanation of the code and full project available in zip. This should work on the Compact Framework, but I'm not 100% sure whether all APIs are available there.
I don't have a CF installation handy, otherwise I would've tried the solutions before posting them.
这篇关于如何储存转换为1bpp对Compact Framework的单色BMP文件的位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!