I just checked and jpegs always end with the same 2 characters so you could test if it was complete. Altho it seems that Mr Falconer's solution will be the simplest.
> I looked at a few jpegs and they all start with the same 10 characters so > you could test on that. What language is this script written in? if it is > Perl I should be able to dig up some code to do this. From what I understand > Jpeg is a streaming format so testing if the whole file is corrupt could be > tricky except visually. > > > > pants:/public_html/jubilee# cat index.html | jpegtopnm > > Not a JPEG file: starts with 0x3c 0x21 > > > > pants:/public_html/jubilee# cat cover.jpg | jpegtopnm > /dev/null > > jpegtopnm: WRITING PPM FILE > > > > Hows that? > > > > On Fri, 2002-05-31 at 13:30, Kerry Baker wrote: > > > Hi all, > > > I am writing a script that downloads a .jpg file from a web site and > > > verifies it is not corrupt. > > > Does anyone know of a command line utility that checks the validity of a > > > jpeg file? > > > > > > Thanks. > > > > > > Kerry. > > > > > >
