TGA is an acronym for Truevision Graphics Adapter and is often referred as TARGA, Truevision Advanced Raster Graphics Adapter. You can convert PNG and JPG images to TGA, or manipulate TGA images using C#. TARGA is actually a raster graphic file format that is supported by Aspose.Imaging for .NET API, along with many other supported file formats. Let us walk through the following headings for an in-depth analysis of TGA images support:
- Convert PNG or JPG to Truevision TGA Images – API Installation
- Convert PNG Image to Truevison TGA using C#
- Converting JPG Image to Truevision TGA using C#
- Manipulate TGA Images using C#
Convert PNG or JPG to Truevision TGA Images – API Installation
You can easily and efficiently convert a PNG or JPG image to a Truevision TGA image in your .NET applications programmatically using C#. The conversion can be performed with few API calls once the API is configured successfully. You can download Aspose.Imaging for .NET API from New Releases or install it via NuGet with the following command:
Install-Package Aspose.Imaging -Version 20.9.0
After configuring the API, let us proceed to convert PNG and JPG images to TGA image file format.
Convert PNG Image to Truevison TGA using C#
The API supports converting PNG image to Truevision TGA images with high fidelity. You can export or render PNG to TGA with the following simple steps:
- Load input PNG image using RasterImage class object
- Pass the reference of the loaded image to TgaImage instance
- Save output image with TGA file extension
The code snippet below shows how to convert PNG image to TGA using C#:
Convert JPG Image to Truevision TGA using C#
JPG images are famous due to their compatibility and popularity over different platforms. However, you might need to convert JPG image to Truevision TGA file in your .NET applications. You need to follow the steps below to perform the conversion:
- Load input JPG image using RasterImage class instance
- Save output TGA using TgaOptions class
The following code snippet shows how to convert JPG to TGA image using C#:
Manipulate TGA Images using C#
We have learned how to create TGA images already. Now, let us explore how to work with existing Truevision TGA or TARGA images. You can edit or update several properties of the TGA image including the Date Time Stamp, Author Name, Image ID and several other properties. Let us follow the steps below for manipulating TGA images:
- Load the input TGA image with TgaImage class
- Edit and Update different properties
- Save output TGA Image
The code snippet below shows how can you edit, update, or manipulate different properties that are exposed by TgaImage class using C# language:
Conclusion
We have considered the requests for Images to TGA conversion and have introduced these features in Aspose.Imaging for .NET API. You can efficiently convert JPG or PNG to TGA images in your .NET applications, as well as manipulate existing TGA mages programmatically using C#. If you are wondering about any questions or ambiguities, then feel free to reach us out at Free Support Forum. You can also take a look at Product Documentation and API References to explore the other features offered by the API.