convert tiff to jpg format

后端 未结 4 2030
天涯浪人
天涯浪人 2020-12-03 08:01

I have a tiff image with two pages. When I convert the file to jpg format I lost second pages. Is there any way to put two images on tiff file into one jpg file. Because of

4条回答
  •  盖世英雄少女心
    2020-12-03 08:56

      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;
                    }
                }
            }
        }
    

    < img src="data:image/jpeg;base64, @ConvertTiffToJpeg.ImageToBase64(@"c:\sample.tif")"/>

    c# .net tiff-to-jpeg tiff

提交回复
热议问题