private void ViewInfo(string[] files) { foreach (string s in files) { var str = ""; var fileInfo = new FileInfo(s); Image image; if (fileInfo.Extension.ToLower() == ".pcx") { image = PcxReader.Load(s); } else { image = Image.FromFile(s); } var res = string.Empty; if (fileInfo.Extension.ToLower() == ".tif") { var temp_res = GetCompressionType(image); var final_res = temp_res < 0 ? 3 : temp_res; res = CompressType[final_res]; } else if (fileInfo.Extension.ToLower() == ".jpg") { res = "Baseline"; } else if (fileInfo.Extension.ToLower() == ".png") { res = "Deflate"; } else if (fileInfo.Extension.ToLower() == ".png") { res = "None"; } var size = image.Height * image.Width; string pixelFormat = Image.GetPixelFormatSize(image.PixelFormat).ToString(); images.Add(new ImageInfo { FileName = fileInfo.Name, Size = size, Dpi = Convert.ToInt32(image.HorizontalResolution), ColorDepth = pixelFormat, Comression = res } ); image.Dispose(); } }
public static Bitmap DecodePCX(string path) { return(PcxReader.Load(path)); }