Speed issue loading image

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am using below statement to load an image;

Me.MyPictureBox.Image = Image.FromFile(CStr(Me.txtMyPhotoPath.Value))

Problem is it is taking too long and slowing the app down. Is there another
faster way to achieve this? or to degrade the quality of image on the fly to
have to load smaller version of image for example?

Thanks

Regards
 
Hi

I am using below statement to load an image;

Me.MyPictureBox.Image = Image.FromFile(CStr(Me.txtMyPhotoPath.Value))

Problem is it is taking too long and slowing the app down. Is there another
faster way to achieve this? or to degrade the quality of image on the fly to
have to load smaller version of image for example?

Thanks

Regards

Would you try:

MyPictureBox.ImageLocation = "c:\image\image.JPG" ' Enter yours

thanks,

Onur
 
John,

It should go as slow as every other tool that reads an image.

But why is that CStr(Me.txtMyPhotoPath.Value)), do you have more of this
kind of senseless code in your class?
It smells if you have used only objects and is all the time boxing and
unboxing.

Cor
 
Is Me.txtMyPhotoPath.Value.ToString better? The field is an Infragistics
UltraText field bound to a table.

Regards
 
John,

Normally that path is given at a string, so what type is that value.

The ToString can never be needed here (or it should be an object) as a path
contains forever (special) characters.

If it is an object the ToString acts in my idea the same as CStr while the
latter makes it only less understandable)

Cor
 
Back
Top