views:

20

answers:

0

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();
                    }