private static bool isCompressed(Stream imageData)
{
if (imageData == null)
return false;
if (imageData.Length <= 2)
return false;
imageData.Seek(0, SeekOrigin.Begin);
int first = imageData.ReadByte();
int second = imageData.ReadByte();
return (first == 0xFF && second == (int)JPEG_MARKER.SOI);
}