C# TIFF JPG Converter Library
How to convert jpg images to multipage TIFF file using C# in ASP.NET, Windows app


C# Demo to Convert and Render JPEG/Png/Bmp to Tiff in Visual C#.NET Project





Overview



To help C# developers to transform & convert various image forms, like Jpeg, Png, Bmp, and REImage object to single or multi-page Tiff image file with no loss in content quality. RasterEdge develops a C#.NET Tiff file converter control, XDoc.Tiff for .NET, which can be stably integrated into C#.NET developing projects, like ASP.NET web applications and .NET Windows Forms applications.





How to convert JPG images to multipage TIFF file using C# code?


The C# source code below shows how to convert JPG images to a multipage tiff image file using C# in your ASP.NET MVC, Windows application.



String inputFilePath = "C:\\1.jpg";
String outputFilePath = "C:\\output.tiff";
//  Convert an image file to TIFF
RasterEdge.XDoc.Converter.ImageConverter.ToDocument(inputFilePath, outputFilePath, FileType.DOC_TIFF);




Use C# Code to Convert Png to Tiff


Then, have a try with Png-to-Tiff conversion demo.



            String[] imagePaths = { @"F:\demo1.png", @"F:\demo2.png", @"F:\demo3.png" };
            Bitmap[] bmps = new Bitmap[3];
            // Step1: Load the image
            for (int i = 0; i < imagePaths.Length; i++)
            {
                Bitmap tmpBmp = new Bitmap(imagePaths[i]);
                if (tmpBmp != null)
                    bmps[i] = tmpBmp;
            }
            // Step2: Construct TIFFDocument object.
            TIFFDocument tifDoc = new TIFFDocument(bmps);
            // Step3: Other operations, like saving it.
            if (tifDoc == null)
                throw new Exception("Fail to construct TIFF Document");
            tifDoc.Save(@"F:\Test.tif");




Use C# Code to Convert Bmp to Tiff with specified compression type


The output TIFF file will be compressed by CCITT Group 3 Fax compression

            String[] imagePaths = { @"F:\demo1.bmp", @"F:\demo2.bmp", @"F:\demo3.bmp" };
            Bitmap[] bmps = new Bitmap[3];
            // Step1: Load the image
            for (int i = 0; i < imagePaths.Length; i++)
            {
                Bitmap tmpBmp = new Bitmap(imagePaths[i]);
                if (tmpBmp != null)
                    bmps[i] = tmpBmp;
            }
            // Step2: Construct TIFFDocument object.
            TIFFDocument tifDoc = new TIFFDocument(bmps,ImageCompress.Group3Fax);
            // Step3: Other operations, like saving it.
            if (tifDoc == null)
                throw new Exception("Fail to construct TIFF Document");
            tifDoc.Save(@"F:\Test.tif");