C#根据byte前两位获取图片扩展名
C#根据byte前两位获取图片扩展名
/// <summary> /// 根据byte前两位获取图片扩展名 /// </summary> /// <param name="bytes01"></param> /// <returns></returns> public static string GetImageExtensionName(string bytes01) { string temp = ".jpg"; switch (bytes01) { case "255216": temp = ".jpg"; break; case "7173": temp = ".gif"; break; case "13780": temp = ".png"; break; case "6677": temp = ".bmp"; break; case "4949": temp = ".tiff"; break; default: temp = ".jpg"; break; } return temp; }
博客内容仅代表个人观点,如发现阐述有误,麻烦指正,谢谢!