📜  c# 网页在图像控件上显示 tiff 的第二页 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:18.060000             🧑  作者: Mango

代码示例2
public static class ConvertTiffToJpeg
    {
        static string base64String = null;
        public static string ImageToBase64(string tifpath)
        {
            string path = tifpath;
            using (System.Drawing.Image image = System.Drawing.Image.FromFile(path))
            {
                using (MemoryStream m = new MemoryStream())
                {
                    image.Save(m, ImageFormat.Jpeg);
                    byte[] imageBytes = m.ToArray();
                    base64String = Convert.ToBase64String(imageBytes);
                    return base64String;
                }
            }
        }
    }