in reply to Testing JPEGs for validity (windows)

A really quick and dirty hack would be to test if the first two bytes in file are 0xFF and 0xD8.
  • Comment on Re: Testing JPEGs for validity (windows)

Replies are listed 'Best First'.
Re^2: Testing JPEGs for validity (windows)
by kosmarnik (Acolyte) on Jul 13, 2010 at 14:17 UTC
    Nah, that would just be checking if they're JPEGs. I need to test the integrity, decode the JPEG. That got me thinking, what about using a module like imagemagick or something to try to decode and get the error report if they have it? Got something surefire of the top of your head?
      Well, imagemagick also requires libjpeg, and so does any other tool that goes through full decoding. If I were you, I'd just apply the patch with _setjmp above to the needed tools.