L
Lance
hey all,
first time vb.net 2005 user, after sticking vb6 out for a long time...
anyway, using this code
======================
Dim FS As FileStream = File.OpenRead(Filename)
Dim theImage As Image
Try
theImage = Image.FromStream(FS, False, False)
Catch ex As Exception
Debug.Print(FS.Name)
FS.Close()
Exit Sub
End Try
Dim Width As Integer = theImage.Width
Dim Height As Integer = theImage.Height
theImage.Dispose()
FS.Close()
========================
works fine except for on a handful of images. all of the images are tif files that open
in evey application i have ever tried to open them in. i'm just getting the width and
height without loading the entire image into memory (they are about 150 MB each and there
are thousands of them). the debug window shows:
"A first chance exception of type 'System.ArgumentException' occurred in
System.Drawing.dll"
on the "bad" ones and if i step into, the error i get is "Parameter not valid" at the
theImage = Image.FromStream(FS, False, False)
line. what could be causing this? the code works for 99.9% of the images, but not for a
handful that are otherwise perfectly fine.
thanks,
lance
first time vb.net 2005 user, after sticking vb6 out for a long time...
anyway, using this code
======================
Dim FS As FileStream = File.OpenRead(Filename)
Dim theImage As Image
Try
theImage = Image.FromStream(FS, False, False)
Catch ex As Exception
Debug.Print(FS.Name)
FS.Close()
Exit Sub
End Try
Dim Width As Integer = theImage.Width
Dim Height As Integer = theImage.Height
theImage.Dispose()
FS.Close()
========================
works fine except for on a handful of images. all of the images are tif files that open
in evey application i have ever tried to open them in. i'm just getting the width and
height without loading the entire image into memory (they are about 150 MB each and there
are thousands of them). the debug window shows:
"A first chance exception of type 'System.ArgumentException' occurred in
System.Drawing.dll"
on the "bad" ones and if i step into, the error i get is "Parameter not valid" at the
theImage = Image.FromStream(FS, False, False)
line. what could be causing this? the code works for 99.9% of the images, but not for a
handful that are otherwise perfectly fine.
thanks,
lance