JPEG format


i’m seeing jpegs that aren’t detected as such by juce.

bool JPEGImageFormat::canUnderstand (InputStream& in)

You always get DD, D8, but not always followed by FF E0 or FF E1. After the FF D8, you can get a different FF XX tag with bogus meta data inserted before things go back to normal.

ideally, these headers should be decoded, but for now, i’ve hacked by version to just check for FF, D8, FF.

[code]bool JPEGImageFormat::canUnderstand (InputStream& in)
const int bytesNeeded = 10;
uint8 header [bytesNeeded];

if ( (header, bytesNeeded) == bytesNeeded)
    return header[0] == 0xff
        && header[1] == 0xd8
        && header[2] == 0xff;
        //&& (header[3] == 0xe0 || header[3] == 0xe1);

return false;




Hmm. Thanks - I’ve relaxed that now.