T
Tim Frawley
I am using a method that was described as the best for avoiding memory
leaks when using MS Picture boxes. The main idea was to use a variable
to load the image from file and then assign the picture box image to
that variable like so:
Dim img as BitMap ' (have tried BitMap and Image)
img = Image.FromFile(OFD.FileName)
PictureBox1.Image = img
This has worked great with my photo album creator as my memory leaks
disappeared like magic.
I have, however, found another issue that I need to work out or find a
workaround for.
If a TIF image has been saved with ZIP or JPEG compression (we are
using Adobe Photoshop) then I get the following Exception when the
variable is loaded From File.
System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at ReadSpecimen.frmReadSpecimen.cmdBrowse_Click(Object sender,
EventArgs e)
Does anyone have any ideas how to make this work with these compressed
formats?
If not does anyone have an idea on how I can detect the compression
properties of a TIF so I can warn the user and avoid the error?
Thanks for any help,
Sincerely,
Timothy Frawley
leaks when using MS Picture boxes. The main idea was to use a variable
to load the image from file and then assign the picture box image to
that variable like so:
Dim img as BitMap ' (have tried BitMap and Image)
img = Image.FromFile(OFD.FileName)
PictureBox1.Image = img
This has worked great with my photo album creator as my memory leaks
disappeared like magic.
I have, however, found another issue that I need to work out or find a
workaround for.
If a TIF image has been saved with ZIP or JPEG compression (we are
using Adobe Photoshop) then I get the following Exception when the
variable is loaded From File.
System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at ReadSpecimen.frmReadSpecimen.cmdBrowse_Click(Object sender,
EventArgs e)
Does anyone have any ideas how to make this work with these compressed
formats?
If not does anyone have an idea on how I can detect the compression
properties of a TIF so I can warn the user and avoid the error?
Thanks for any help,
Sincerely,
Timothy Frawley