pants:/public_html/jubilee# file cover.jpg 
cover.jpg: JPEG image data, JFIF standard 1.02, resolution (DPI),125x125
pants:/public_html/jubilee# cp cressy.png c.jpg
pants:/public_html/jubilee# file c.jpg 
c.jpg: PNG image data, 233 x 105, 8-bit colormap, non-interlaced

However this doesn't pick up truncated jpgs...

pants:/public_html/jubilee# head -1 cover.jpg | file -
standard input:JPEG image data, JFIF standard 1.02, resolution (DPI),
125x125

...whereas this one does...

pants:/public_html/jubilee# head -1 cover.jpg | jpegtopnm 
Premature end of JPEG file
JPEG datastream contains no image

Note - the details are left as an exercist to the reader.

On Fri, 2002-05-31 at 13:32, C Falconer wrote:
> 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:
> > 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?


Reply via email to