New bitmap() is very slow

  • Thread starter Thread starter George Yefchak
  • Start date Start date
G

George Yefchak

Hi folks,

I load a JPEG image, say around 300 kBytes, from disk as follows:

myBitmap = New Bitmap(openDlg.FileName)

I then make a copy of this as follows:

bmpImage = New Bitmap(myBitmap )

This 2nd call can take up to TEN SECONDS to execute. What's up with that?
Should I be doing this a different way?

Thanks,
--George
 
Hi,

Try bmpImage = MyBitmap.clone

Ken
----------------------
Hi folks,

I load a JPEG image, say around 300 kBytes, from disk as follows:

myBitmap = New Bitmap(openDlg.FileName)

I then make a copy of this as follows:

bmpImage = New Bitmap(myBitmap )

This 2nd call can take up to TEN SECONDS to execute. What's up with that?
Should I be doing this a different way?

Thanks,
--George
 
George Yefchak said:
I load a JPEG image, say around 300 kBytes, from disk as follows:

myBitmap = New Bitmap(openDlg.FileName)

I then make a copy of this as follows:

bmpImage = New Bitmap(myBitmap )

This 2nd call can take up to TEN SECONDS to execute. What's up with that?
Should I be doing this a different way?


How about making a hard copy?

bmpImage = New Bitmap(myBitmap.Width, myBitmap.Height)
Dim grx as graphics = graphics.FromBitmap(bmpImage)
grx.DrawImage(myBitmap, 0,0)
grx.Dispose


LFS
 

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

Back
Top