Checking JPEG image dimension from partial headers