Creating Bitmap is very slow

J

James Dean

In my program i create a 32ARGB bitmap. To actually create the bitmap
seems very slow. In fairness the file size is very big. I support
multiple bitmaps as well. I have to convert these bitmaps to thumbnails
also which again seems very slow. There is a memory bitmap but i can't
seem to find any good information about it. I want to be able to create
a 32bpp bitmap as fast as possible and also try to make a thumbnail as
fast as possible too. The problem is i have to create the entire bitmap
to be able to create the thumbnail. Can anyone give me good advice on
what to do here......
 
N

Nicholas Paldino [.NET/C# MVP]

James,

How are you creating the thumbnail? Also, how are you creating a
bitmap? You said the file size is quite large, so that obviously can have
an effect.

Can you post any relevant sections of code?
 
J

James Dean

bitmap = new
Bitmap(PageSizeInPixels.Width,PageSizeInPixels.Height,PixelFormat.Format
32bppRgb);

GraphicsUnit unit = GraphicsUnit.Pixel;

RectangleF boundsF = bitmap.GetBounds(ref unit);
Rectangle bounds = new Rectangle((int) boundsF.X,
(int) boundsF.Y,
(int) boundsF.Width,
(int) boundsF.Height);

bitmapData =
bitmap.LockBits(bounds, ImageLockMode.WriteOnly,
bitmap.PixelFormat);


//Here set all the bytes in the newly created file.
/* I have 1bpp information stored in a byte array and from this array i
know which pixels to set in this newly created bitmap.....For each color
i have a byte array telling me which pixels to set in the bitmap for
that color.*/

bitmap.unlock();

When i have this image created i make a thumbnail.....could i directly
make a thumnail for this image without creating this huge
image.......how do i do that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top