Click to See Complete Forum and Search --> : Image Validate and Save JPG
coldie
Jun 20th, 2000, 05:35 PM
I made a program that looks for images in a certin folder including subfolders to detect doubles.
My problem is that as soon as a picture (JPG or GIF) is not complete (aborted download, etc) the LoadPicture hangs up and the program crashes with out generating any error message (so On Error won't work).
How can I check that a picture is valid before loading it?
I also have a problem saving pictures in other formats than BMP. Is there any nice OCX or anything that can sort me out?
Cheers..
DiGiTaIErRoR
Oct 16th, 2003, 03:07 AM
I'd also like to know how to validate an image so VB won't crash.
:mad:
si_the_geek
Oct 16th, 2003, 04:26 AM
I'd like to know how to dig up dead threads :lol:
anyway... never seen the problem, but I have an idea: how about using a very simple DLL which just loads the picture into an object variable (& sets it to nothing after), then returns True.
In the calling program you can just make sure that true is returned, if not (or if it returns an error) then the picture isnt safe.
DiGiTaIErRoR
Oct 16th, 2003, 11:08 AM
I was searching for an answer but didn't find one.
And when it does error it consumes CPU.
si_the_geek
Oct 16th, 2003, 11:10 AM
ah.. pants!
in that case I guess you'll have to check the file format yourself to make sure that all the markers are there/there is enough data.
I don't know the format... best to ask Wotsit (http://www.wotsit.org)
DiGiTaIErRoR
Oct 16th, 2003, 11:32 AM
The problem is I don't know exactly what causes the error in the LoadPicture function.
And I'll have to be validating several file types.
:mad:
cyborg
Oct 16th, 2003, 08:56 PM
load the file in binary mode and get the header. (check wotsit.org)
if its 8-bit filesize should be width*height+len(header)
if its 32-bit it should be width*height*3+len(header)
dunno about the others...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.