This topic covers the details of how to convert TIFF to PNG in C#. It encompasses all the resources, important classes, methods and a runnable sample code to Convert TIFF to PNG in C#. The application can be used in any of the .NET supported environments inside Windows, Linux, or macOS.
Steps to Convert TIFF to PNG in C#
- Establish the environment to use Aspose.Imaging using the NuGet package manager
- Access the source TIFF file using the Image class instance and cast it to TiffImage
- Iterate through every TIFF frame
- Save the selected TIFF frame as a PNG on the disk using default PngOptions
By following the above mentioned steps, you can easily manage to convert every frame inside a TIFF to PNG using C# in a step-by-step approach where first of all, we will establish the environment by utilizing the required resources inside the project and then the source TIFF image is loaded using an instance of the Image class. The loaded image will then be cast to an instance of the TiffImage class, which is then followed by accessing every frame inside the TIFF image. Every TIFF frame will be saved on the disk as a separate PNG file on the disk using the default PngOptions instance.
Code to Convert TIFF to PNG using C#
With the help of the above example code, you can easily change TIFF to PNG using C# with the help of very few API calls. The Image class instance supports multiple image types and has numerous overloaded methods that can be used to load the images either from a stream or from a disk along with other additional LoadOptions parameters. With the help of LoadOptions class, you can set the progress event handler, data background color, data recovery mode, and buffer size hint.
In this article, we have learnt about the process to convert TIFF to PNG using C#. If you are interested in compressing the PNG file, refer to the article on how to compress a PNG in C#.