Class TgaImage
Namespace: Aspose.Imaging.FileFormats.Tga
Assembly: Aspose.Imaging.dll (25.2.0)
Manipulate TGA raster image files with our API, tailored for the TARGA (Truevision Advanced Raster Adapter) format, enabling seamless loading and customization. Easily update public properties such as author, timestamp, image ID, and software version, while using various bits per pixel settings, alpha channel and color transparency. Additionally, you can export TGA images to other popular raster formats, ensuring compatibility for your projects.
[JsonObject(MemberSerialization.OptIn)]
public class TgaImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← TgaImage
Implements
IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
Inherited Members
RasterCachedImage.CacheData(), RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte), RasterCachedImage.Resize(int, int, ResizeType), RasterCachedImage.Resize(int, int, ImageResizeSettings), RasterCachedImage.RotateFlip(RotateFlipType), RasterCachedImage.Rotate(float, bool, Color), RasterCachedImage.Crop(Rectangle), RasterCachedImage.Dither(DitheringMethod, int, IColorPalette), RasterCachedImage.Grayscale(), RasterCachedImage.BinarizeFixed(byte), RasterCachedImage.BinarizeOtsu(), RasterCachedImage.BinarizeBradley(double, int), RasterCachedImage.BinarizeBradley(double), RasterCachedImage.AdjustBrightness(int), RasterCachedImage.AdjustContrast(float), RasterCachedImage.AdjustGamma(float, float, float), RasterCachedImage.AdjustGamma(float), RasterCachedImage.OnCached(), RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette), RasterCachedImage.IsCached, RasterImage.xmpData, RasterImage.RemoveMetadata(), RasterImage.Save(Stream, ImageOptionsBase, Rectangle), RasterImage.GetModifyDate(bool), RasterImage.Dither(DitheringMethod, int), RasterImage.Dither(DitheringMethod, int, IColorPalette), RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings), RasterImage.GetDefaultArgb32Pixels(Rectangle), RasterImage.GetDefaultRawData(Rectangle, RawDataSettings), RasterImage.GetArgb32Pixel(int, int), RasterImage.GetPixel(int, int), RasterImage.SetArgb32Pixel(int, int, int), RasterImage.SetPixel(int, int, Color), RasterImage.ReadScanLine(int), RasterImage.ReadArgb32ScanLine(int), RasterImage.WriteScanLine(int, Color[]), RasterImage.WriteArgb32ScanLine(int, int[]), RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader), RasterImage.LoadArgb32Pixels(Rectangle), RasterImage.LoadArgb64Pixels(Rectangle), RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader), RasterImage.LoadPixels(Rectangle), RasterImage.LoadCmykPixels(Rectangle), RasterImage.LoadCmyk32Pixels(Rectangle), RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings), RasterImage.SaveArgb32Pixels(Rectangle, int[]), RasterImage.SavePixels(Rectangle, Color[]), RasterImage.SaveCmykPixels(Rectangle, CmykColor[]), RasterImage.SaveCmyk32Pixels(Rectangle, int[]), RasterImage.SetResolution(double, double), RasterImage.SetPalette(IColorPalette, bool), RasterImage.Resize(int, int, ImageResizeSettings), RasterImage.Rotate(float, bool, Color), RasterImage.Rotate(float), RasterImage.BinarizeFixed(byte), RasterImage.BinarizeOtsu(), RasterImage.BinarizeBradley(double), RasterImage.BinarizeBradley(double, int), RasterImage.Blend(Point, RasterImage, Rectangle, byte), RasterImage.Blend(Point, RasterImage, byte), RasterImage.Grayscale(), RasterImage.AdjustBrightness(int), RasterImage.AdjustContrast(float), RasterImage.AdjustGamma(float, float, float), RasterImage.AdjustGamma(float), RasterImage.GetSkewAngle(), RasterImage.NormalizeAngle(), RasterImage.NormalizeAngle(bool, Color), RasterImage.Filter(Rectangle, FilterOptionsBase), RasterImage.ReplaceColor(Color, byte, Color), RasterImage.ReplaceColor(int, byte, int), RasterImage.ReplaceNonTransparentColors(Color), RasterImage.ReplaceNonTransparentColors(int), RasterImage.ToBitmap(), RasterImage.ReleaseManagedResources(), RasterImage.UpdateMetadata(), RasterImage.UpdateDimensions(int, int), RasterImage.PremultiplyComponents, RasterImage.UseRawData, RasterImage.UpdateXmpData, RasterImage.XmpData, RasterImage.RawIndexedColorConverter, RasterImage.RawCustomColorConverter, RasterImage.RawFallbackIndex, RasterImage.RawDataSettings, RasterImage.UsePalette, RasterImage.RawDataFormat, RasterImage.RawLineSize, RasterImage.IsRawDataAvailable, RasterImage.HorizontalResolution, RasterImage.VerticalResolution, RasterImage.HasTransparentColor, RasterImage.HasAlpha, RasterImage.TransparentColor, RasterImage.ImageOpacity, RasterImage.DataLoader, Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
Saving of the JPG image as a TGA image.```csharp [C#]
using (RasterImage image = (JpegImage)Image.Load("test.jpg"))
{
image.Save("test.tga"", new TgaOptions());
}
Loading of the PNG image, conversion of it to the TgaImage and saving as a TGA image.```csharp
[C#]
using (RasterImage image = (RasterImage)Image.Load("test.png"))
{
using (TgaImage tgaImage = new TgaImage(image))
{
tgaImage.Save("test.tga");
}
}
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
Constructors
TgaImage(string)
Initializes a new Aspose.Imaging.FileFormats.Tga.TgaImage object using the provided file path for loading the image content. This constructor efficiently initializes the image instance, allowing seamless access to TGA image files, simplifying integration into your application workflow.
public TgaImage(string path)
Parameters
path
string
The path to load an image.
Exceptions
Specified path is null.
TgaImage(RasterImage)
Create a new instance of the Aspose.Imaging.FileFormats.Tga.TgaImage class by providing a raster image object. This constructor facilitates the direct integration of existing raster images into the TGA image format, streamlining the conversion process for enhanced compatibility within your software systems.
public TgaImage(RasterImage rasterImage)
Parameters
rasterImage
RasterImage
The raster image.
Examples
Loading of the PNG image, conversion of it to the TgaImage and saving as a TGA image.```csharp [C#]
using (RasterImage image = (RasterImage)Image.Load("test.png"))
{
using (TgaImage tgaImage = new TgaImage(image))
{
tgaImage.Save("test.tga");
}
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage__ctor_System_IO_Stream_"></a> TgaImage\(Stream\)
Initialize a new instance of the Aspose.Imaging.FileFormats.Tga.TgaImage class using a stream to
load the image. This constructor allows for seamless integration of image data
from streams, facilitating efficient handling and processing of TGA images within
your software applications.
```csharp
public TgaImage(Stream stream)
Parameters
stream
Stream
The stream to load an image.
Properties
AuthorComments
Retrieves or sets the comments provided by the author of the image. These comments often contain valuable information, such as descriptions, annotations, or additional context about the image. By accessing or modifying the Author Comments property, developers can enhance the metadata associated with the image, providing users with valuable insights and context regarding its content or creation. This is an ASCII field consisting of 324 bytes which are organized as four lines of 80 characters, each followed by a null terminator.
public string AuthorComments { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
AuthorName
Retrieves or sets the name of the author associated with the image. This property allows developers to access or modify the author’s name metadata, providing valuable information about the creator of the image. By utilizing the Author Name property, users can easily identify the individual responsible for creating or contributing to the image, enhancing its overall metadata and providing valuable context for viewers. This field is a total of 40 ASCII characters for the name. If the field is used, it should contain the name of the person who created the image (author).
public string AuthorName { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
BackgroundColor
Retrieves or sets the background color of the image. This property allows you to specify the color used for the image background, ensuring consistency and enhancing visual presentation. It is particularly useful for scenarios where the image is displayed on a background with a different color or when rendering the image onto another canvas.
public override Color BackgroundColor { get; set; }
Property Value
BitsPerPixel
Retrieve the bits per pixel value, providing essential information about the image’s color depth. This property serves as a crucial metric for understanding the level of detail and color richness present in the image, aiding developers in optimizing processing algorithms and resource allocation for efficient image manipulation and rendering tasks.
public override int BitsPerPixel { get; }
Property Value
BytesPerPixel
Obtain the bytes per pixel value, which denotes the amount of memory occupied by each pixel in the image. This property serves as a crucial metric for memory management and optimization, aiding developers in efficiently allocating resources and processing image data
public int BytesPerPixel { get; }
Property Value
DateTimeStamp
Gets or sets Date/Time Stamp. This field defines the value for the date and time that the image was saved. Even though operating systems typically time- and date-stamp files, this feature is provided because the operating system may change the time and date stamp if the file is copied. By using this area, you are guaranteed an unmodified region for date and time recording.
public DateTime? DateTimeStamp { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
FileFormat
Get crucial information about the file format of the image represented by this instance of Aspose.Imaging.FileFormats.Tga.TgaImage. Understanding the file format is essential for compatibility checks and ensuring seamless integration within software systems, enabling efficient processing and manipulation of images.
public override FileFormat FileFormat { get; }
Property Value
GammaValueDenominator
Retrieves the denominator part of the gamma value, an integral factor in determining color representation within images. For images lacking gamma correction, this value should be 1.0, ensuring accurate color rendering. Appreciating and leveraging this parameter is fundamental for upholding color fidelity and achieving precise image visualization.
public ushort GammaValueDenominator { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_GammaValueNumerator"></a> GammaValueNumerator
Gets the numerator part of the gamma value, which is essential for accurate color
representation in images. In images without gamma correction, this value should be
1.0. Understanding and utilizing this value is crucial for maintaining color
fidelity and ensuring accurate image rendering.
```csharp
public ushort GammaValueNumerator { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_HasAlpha"></a> HasAlpha
Retrieve a boolean value indicating whether the Aspose.Imaging.FileFormats.Tga.TgaImage includes an
alpha channel, facilitating transparency effects. This property provides essential
information for handling image composition and rendering, assisting developers in
implementing diverse visual effects and compositing operations.
```csharp
public override bool HasAlpha { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_HasBackgroundColor"></a> HasBackgroundColor
Retrieves or sets a value indicating whether the image contains a background
color. This property is useful for determining whether the image includes a
distinct background color separate from the foreground content. It enables
you to customize image processing or rendering based on the presence or absence of
a background color.
```csharp
public override bool HasBackgroundColor { get; set; }
Property Value
HasColorMap
Retrieve whether this Aspose.Imaging.FileFormats.Tga.TgaImage instance contains a color map. Understanding the presence of a color map is crucial for accurate interpretation and manipulation of the image’s color data.
public bool HasColorMap { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_HasTransparentColor"></a> HasTransparentColor
Retrieves or sets a boolean value indicating whether the image contains a
transparent color. This property is essential for identifying whether the image
supports transparency, helping you to implement appropriate handling of
transparency-related operations such as blending, compositing, or masking.
```csharp
public override bool HasTransparentColor { get; set; }
Property Value
Height
Obtain the height of the image encapsulated by this Aspose.Imaging.FileFormats.Tga.TgaImage instance. This property furnishes developers with critical details concerning the image’s vertical dimensions, enabling seamless integration and manipulation of images within their software solutions.
public override int Height { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_ImageId"></a> ImageId
Gets or sets the unique identifier associated with the image. This ID serves as a
reference point for identifying and distinguishing the image from others within a
system or application. By setting or retrieving the Image ID, you can manage and
track images effectively, facilitating organized image management and retrieval
processes.
<p>This optional field contains identifying information about the image. The maximum length
for this field is 255 bytes.</p>
```csharp
public string ImageId { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
IsGrayScale
Obtain a boolean value indicating whether the Aspose.Imaging.FileFormats.Tga.TgaImage represents a gray-scale image. This property is crucial for distinguishing between color and gray-scale images, aiding developers in applying appropriate processing and rendering techniques based on the image’s color characteristics.
public bool IsGrayScale { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_JobNameOrId"></a> JobNameOrId
Retrieves or sets the job name or ID associated with the image. This property
enables you to access or modify metadata related to the specific job or project
associated with the image. By utilizing the Job Name/ID property, users can easily
identify the project or task to which the image pertains, facilitating
organization and management of image assets within larger workflows or projects.
```csharp
public string JobNameOrId { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
JobTime
Retrieves or sets the timestamp indicating the job time associated with the image. This property allows developers to access or modify the time metadata related to the specific job or project associated with the image.
public TimeSpan? JobTime { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
PixelAspectRatioDenominator
Retrieves the denominator part of the Pixel Aspect Ratio, a crucial factor in determining the visual aspect of pixels within the image. This value is essential for preserving accurate pixel representation and aspect ratios throughout various image rendering and processing operations, ensuring high-quality visual output.
public ushort PixelAspectRatioDenominator { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_PixelAspectRatioNumerator"></a> PixelAspectRatioNumerator
Retrieves the numerator component of the Pixel Aspect Ratio, which influences the
visual aspect of pixels within the image. Understanding and manipulating this
value is essential for achieving accurate pixel representation and aspect ratios
in image rendering and processing.
```csharp
public ushort PixelAspectRatioNumerator { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_SoftwareId"></a> SoftwareId
Manages the software identification (ID) associated with the image, allowing for
up to 40 ASCII characters. This property serves as a means to uniquely identify
the software utilized in creating or processing the image, providing valuable
metadata for organizational and informational purposes.
```csharp
public string SoftwareId { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
SoftwareVersion
Retrieves or sets the software version associated with the image. The accepted length for the version string is typically 3 to 4 characters. This property is useful for tracking the software used to create or manipulate the image and can provide valuable context for image processing and compatibility checks.
public string SoftwareVersion { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
SoftwareVersionLetter
Retrieves or sets the letter component of the software version associated with the image. This property represents an additional detail within the software version string and can be useful for finer version differentiation.
public char SoftwareVersionLetter { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
SoftwareVersionNumber
Retrieves or sets the numeric component of the software version associated with the image. This property represents the numerical part of the software version string, providing important information about the version of the software used to create or modify the image.
public ushort SoftwareVersionNumber { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
TransparentColor
Retrieves or sets the key color associated with the image. This property allows you to access or modify the color designated as the key color for specific image processing tasks or effects. Utilizing the Key Color property enables users to apply color-based operations such as chroma keying or color replacement, enhancing image manipulation capabilities and creative possibilities.
The Key Color can be thought of as the ‘background color’ or ‘transparent color’. This is the color of the ‘non image’ area of the screen, and the same color that the screen would be cleared to if erased in the application.
public override Color TransparentColor { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
Width
Retrieve the width of the image represented by this Aspose.Imaging.FileFormats.Tga.TgaImage instance. This property provides developers with essential information about the image dimensions, facilitating various image manipulation and processing tasks within their software applications.
public override int Width { get; }
Property Value
Examples
Getting values of the public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
### <a id="Aspose_Imaging_FileFormats_Tga_TgaImage_XOrigin"></a> XOrigin
Gets or sets absolute horizontal coordinate for the lower left corner of the image
as it is positioned on a display device having an origin at the lower left of the
screen(e.g., the TARGA series).
```csharp
public ushort XOrigin { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
YOrigin
Gets or sets absolute vertical coordinate for the lower left corner of the image as it is positioned on a display device having an origin at the lower left of the screen(e.g., the TARGA series).
public ushort YOrigin { get; set; }
Property Value
Examples
Updating public properties of the loaded TGA image.```csharp [C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
image.DateTimeStamp = testTime;
image.AuthorName = "John Smith";
image.AuthorComments = "Comment";
image.ImageId = "ImageId";
image.JobNameOrId = "Important Job";
image.JobTime = TimeSpan.FromDays(10);
image.TransparentColor = Color.FromArgb(123);
image.SoftwareId = "SoftwareId";
image.SoftwareVersion = "abc1";
image.SoftwareVersionLetter = 'a';
image.SoftwareVersionNumber = 2;
image.XOrigin = 1000;
image.YOrigin = 1000;
image.Save("test.tga")
}
Getting values of the public properties of the loaded TGA image.```csharp
[C#]
using (TgaImage image = (TgaImage)Image.Load("test.tga"))
{
dateTimeStamp = image.DateTimeStamp;
authorName = image.AuthorName;
authorComments = image.AuthorComments;
imageId = image.ImageId;
jobNameOrId = image.JobNameOrId;
jobTime = image.JobTime;
keyColor = image.TransparentColor;
softwareId = image.SoftwareId;
softwareVersion = image.SoftwareVersion;
softwareVersionLetter = image.SoftwareVersionLetter;
softwareVersionNumber = image.SoftwareVersionNumber;
xOrigin = image.XOrigin;
yOrigin = image.YOrigin;
gammaValueDenominator = image.GammaValueDenominator;
gammaValueNumerator = image.GammaValueNumerator;
hasAlphaChannel = image.HasAlpha;
hasColorMap = image.HasColorMap;
height = image.Height;
isGrayScale = image.IsGrayScale;
pixelAspectRatioDenominator = image.PixelAspectRatioDenominator;
pixelAspectRatioNumerator = image.PixelAspectRatioNumerator;
size = image.Size;
width = image.Width;
}
Methods
Clone()
Produces a duplicate of the current instance, generating a new object that clones all attributes and properties of the original. This method facilitates the creation of identical copies, ensuring data integrity and preserving the state of the current instance without affecting the original object.
public TgaImage Clone()
Returns
Returns a new object that is a copy of the current instance.
Clone(TgaImage)
Replicate the properties of another Aspose.Imaging.FileFormats.Tga.TgaImage object, creating a new instance with identical attributes. This operation ensures the preservation of data integrity and facilitates the duplication of image properties without altering the source object.
public void Clone(TgaImage tgaImage)
Parameters
tgaImage
TgaImage
Other Aspose.Imaging.FileFormats.Tga.TgaImage
Crop(Rectangle)
Crop the image to a specified region. This method allows you to define a rectangular area within the image to retain, discarding the rest. This operation is useful for focusing on specific content within the image or removing unwanted portions.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
The rectangle.
Crop(int, int, int, int)
Crop the image by specifying shifts for the left, right, top, and bottom boundaries. This method allows you to trim the image by moving its boundaries independently along the horizontal and vertical axes. By adjusting these shifts, you can precisely control which portions of the image to retain, effectively cropping it to the desired dimensions.
public override void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
Parameters
leftShift
int
The left shift.
rightShift
int
The right shift.
topShift
int
The top shift.
bottomShift
int
The bottom shift.
Equals(TgaImage)
In an equality comparison, the method evaluates whether the current Aspose.Imaging.FileFormats.Tga.TgaImage instance is equal to the second image provided as a parameter. This operation facilitates determining if two TGA images are identical, aiding in image processing and comparison tasks.
public bool Equals(TgaImage other)
Parameters
other
TgaImage
Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
Returns
Comparison results.
Equals(object)
The method performs an equality comparison between the current Aspose.Imaging.FileFormats.Tga.TgaImage instance and another object provided as a parameter. Specifically, it evaluates whether the properties of the current image match those of the second object, assisting in determining their equivalence for comparison purposes within image processing workflows.
public override bool Equals(object other)
Parameters
other
object
Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
Returns
Comparison results.
GetHashCode()
Retrieve the hash code of the current instance. However, it’s important to note that this hash code may not be suitable for use as a key, particularly because instances of the TgaImage class are not immutable.
public override int GetHashCode()
Returns
Hash code of this instance.
Resize(int, int, ImageResizeSettings)
Resize the image while applying specific settings to maintain the desired dimensions and aspect ratio. By customizing image settings, you can effectively resize the image while ensuring optimal visual quality and compatibility with different display devices or applications.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
settings
ImageResizeSettings
The resize settings.
Resize(int, int, ResizeType)
Adjusts the size of the image using a specified resize type, which determines how the resizing operation is performed. This method provides flexibility in resizing images according to different algorithms or techniques. By choosing the appropriate resize type, you can achieve the desired balance between image quality and computational efficiency based on specific requirements or preferences.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
resizeType
ResizeType
The resize type.
Rotate(float, bool, Color)
Rotates the image around its center by a specified angle while maintaining resize proportionality and preserving the background color. This method allows for precise image manipulation, ensuring that the rotation maintains visual balance and consistency with the specified background color. It’s ideal for tasks where accurate rotation around the center is necessary, such as orientation correction or artistic adjustments.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
The rotate angle in degrees. Positive values will rotate clockwise.
resizeProportionally
bool
if set to true
you will have your image size changed
according to rotated rectangle (corner points) projections in other
case that leaves dimensions untouched and only
internal image contents are rotated.
backgroundColor
Color
Color of the background.
RotateFlip(RotateFlipType)
The “RotateFlip” method enables rotating and flipping operations on the image. It offers versatile functionality for manipulating image orientation, allowing users to perform rotations and flips according to their requirements, facilitating efficient image processing tasks within software applications.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipType
The rotate flip type.
SaveData(Stream)
The save data.
protected override void SaveData(Stream stream)
Parameters
stream
Stream
The stream.
UpdateDimensions(int, int)
The update dimensions.
protected override void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
The new width.
newHeight
int
The new height.
Operators
operator ==(TgaImage, TgaImage)
Performs an equality comparison between two TGA images, considering both the first and second images involved in the comparison process. This method facilitates straightforward assessment of image equality, ensuring accurate analysis and decision-making within image processing workflows.
public static bool operator ==(TgaImage first, TgaImage second)
Parameters
first
TgaImage
First Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
second
TgaImage
Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
Returns
Comparison results.
operator !=(TgaImage, TgaImage)
Conducts a non-equality comparison between two TGA images, evaluating both the first and second images involved in the comparison. This method aids in identifying discrepancies or differences between images, enabling precise analysis and decision-making in image processing tasks.
public static bool operator !=(TgaImage first, TgaImage second)
Parameters
first
TgaImage
First Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
second
TgaImage
Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.
Returns
Comparison results.