English 中文(简体)
从C#的档案中提取48bpp标
原标题:initializing a 48bpp bitmap from a file in c#

I write a 48bppRgb to a file but when I create a bitmap from this file it is 32bppArgb(object img2 has a property PixelFormat.32bppArgb).

Minimized example:

Bitmap img1 = new Bitmap(100, 100, PixelFormat.Format48bppRgb);
img1.Save("/img1.bmp");
Bitmap img2 = new Bitmap("/img1.bmp");

Why?

最佳回答

不止一个问题。 您没有在BMP格式中挽救形象。 图像的缺省格式。 Save(string) is PNG. PNG encoder建在GDI+值中,不支持48bpp图像。 要想实现最佳环保做法,就必须明确形象格式:

        Bitmap img1 = new Bitmap(100, 100, PixelFormat.Format48bppRgb);
        img1.Save("c:/temp/img1.bmp", ImageFormat.Bmp);

然而,你发现,BMP encoder并不支持48bpp图像,在你回电时,你就会有24个灯。 没有任何法典支持48bpp。

在GDI+中有许多功能缺失。 图表。 例如,Icon公司没有工作,实际上拯救了一个PNG。 而且,对指数化石料形式的任何一种支持都很差。 如果你需要这种支持,你就需要一个专业的成像图书馆。 铅、ool或成像是通常的选择。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签