开发者

open multi image pages to different Bitmap objects in .net

开发者 https://www.devze.com 2023-01-18 11:03 出处:网络
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.

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开发者_C百科.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();
                    }
0

精彩评论

暂无评论...
验证码 换一张
取 消