/// <summary>
/// 判断图片是否正常。
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static bool ImgNormal(string filePath)
{
byte[] imgArray;
try
{
imgArray = File.ReadAllBytes(filePath);
}
finally
{
}
if (imgArray != null && imgArray.Length > 2)
{
int length = imgArray.Length;
if (length > 2)
{
byte a = imgArray[length - 1];
byte b = imgArray[length - 2];
return a > 0 && b > 0;
//判断倒序最后两位是不是217,255
//return (a == 217 && b == 255)
// || (a == 130 && b == 96);
}
else
{
return false;
}
}
else
{
return false;
}
}