打开多图像页面到.net中的不同位图对象

发布于 2024-09-25 20:14:50 字数 792 浏览 3 评论 0原文

我正在开发一个图像编辑器,其结构需要为每个页面使用不同的 Bitmap 对象。但在.net中我找不到好的方法。

当我使用 Bitmap.Clone() 时,它给出相同的位图(不仅仅是一页)

下面的代码工作正常,但它又脏又慢。

那么打开多图像以分离位图对象的最佳方法是什么?

                    for (int i = 0; i < frameCount; i++)
                    {
                        bmp.SelectActiveFrame(FrameDimension.Page, i);
                        MemoryStream ms = new MemoryStream();
                        bmp.Save(ms, ImageFormat.Bmp);

                        Bitmap outImg = new Bitmap(ms);
                        outImg.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution);

                        AddFrame(name, outImg, mimeType);//This creates a class inluding a bitmap object
                        Application.DoEvents();
                    }

I am developing an image editor and the structure needs a different Bitmap object for each page. But in .net i couldnt find a fine way.

When i use Bitmap.Clone() it gives the same bitmap (not only one page)

The code below works fine but its dirty and slow.

So what would be the best way of opening a multi-image to separate Bitmap objects?

                    for (int i = 0; i < frameCount; i++)
                    {
                        bmp.SelectActiveFrame(FrameDimension.Page, i);
                        MemoryStream ms = new MemoryStream();
                        bmp.Save(ms, ImageFormat.Bmp);

                        Bitmap outImg = new Bitmap(ms);
                        outImg.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution);

                        AddFrame(name, outImg, mimeType);//This creates a class inluding a bitmap object
                        Application.DoEvents();
                    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文