Class TgaImage

Class TgaImage

Namespace: Aspose.Imaging.FileFormats.Tga
Assembly: Aspose.Imaging.dll (25.7.0)

Manipulate TGA raster image files with our API, tailored for the TARGA(Truevision Advanced Raster Adapter) format, enabling seamless loading andcustomization. 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 imagesto 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.NormalizeHistogram() , 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.NormalizeHistogram() , 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.

using (JpegImage image = 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.

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.

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.

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 forloading the image content. This constructor efficiently initializes the imageinstance, allowing seamless access to TGA image files, simplifying integrationinto your application workflow.

public TgaImage(string path)
   {
   }

Parameters

path string

The path to load an image.

Exceptions

ArgumentNullException

Specified path is null.

TgaImage(RasterImage)

Create a new instance of the Aspose.Imaging.FileFormats.Tga.TgaImage class by providing a rasterimage object. This constructor facilitates the direct integration of existingraster images into the TGA image format, streamlining the conversion process forenhanced 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.

using (RasterImage image = (RasterImage)Image.Load("test.png"))
   {
       using (TgaImage tgaImage = new TgaImage(image))
       {
           tgaImage.Save("test.tga");
       }
   }

TgaImage(Stream)

Initialize a new instance of the Aspose.Imaging.FileFormats.Tga.TgaImage class using a stream toload the image. This constructor allows for seamless integration of image datafrom streams, facilitating efficient handling and processing of TGA images withinyour software applications.

public TgaImage(Stream stream)
   {
      using (var reader = new BinaryReader(stream))
      {
         int idLength = reader.ReadInt32();
         byte[] id = reader.ReadBytes(idLength);
         if (!TgaImageHelper.IsIdValid(id))
            throw new Exception("Invalid TGA image.");
         int width = reader.ReadInt32();
         int height = reader.ReadInt32();
         byte typeCode = reader.ReadByte();
         if (typeCode != 2 && typeCode != 10)
            throw new Exception("Unsupported TGA image type.");
         int imageLength = reader.ReadInt32();
         byte[] pixels = reader.ReadBytes(imageLength);
         CreateImage(width, height, pixels);
      }
   }

Parameters

stream Stream

The stream to load an image.

Properties

AuthorComments

Retrieves or sets the comments provided by the author of the image. These commentsoften contain valuable information, such as descriptions, annotations, oradditional context about the image. By accessing or modifying the Author Commentsproperty, developers can enhance the metadata associated with the image, providingusers with valuable insights and context regarding its content or creation.This is an ASCII field consisting of 324 bytes which are organized as four linesof 80 characters, each followed by a null terminator.

public string AuthorComments
{
    get;
    set;
}

Property Value

string

Examples

Updating public properties of the loaded TGA image.

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.

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 propertyallows developers to access or modify the author’s name metadata, providingvaluable information about the creator of the image. By utilizing the Author Nameproperty, users can easily identify the individual responsible for creating orcontributing to the image, enhancing its overall metadata and providing valuablecontext 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

string

Examples

Updating public properties of the loaded TGA image.

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.

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 allowsyou to specify the color used for the image background, ensuring consistency andenhancing visual presentation. It is particularly useful for scenarios where theimage is displayed on a background with a different color or when rendering theimage onto another canvas.

public override Color BackgroundColor
    {
        get;
        set;
    }

Property Value

Color

BitsPerPixel

Retrieve the bits per pixel value, providing essential information about theimage’s color depth. This property serves as a crucial metric for understandingthe level of detail and color richness present in the image, aiding developers inoptimizing processing algorithms and resource allocation for efficient imagemanipulation and rendering tasks.

public override int BitsPerPixel
    {
        get;
    }

Property Value

int

BytesPerPixel

Obtain the bytes per pixel value, which denotes the amount of memory occupied byeach pixel in the image. This property serves as a crucial metric for memorymanagement and optimization, aiding developers in efficiently allocating resourcesand processing image data

public int BytesPerPixel
    {
        get;
    }

Property Value

int

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 isprovided because the operating system may change the time and date stamp if the file iscopied. By using this area, you are guaranteed an unmodified region for date and timerecording.

public DateTime? DateTimeStamp
   {
      get;
      set;
   }

Property Value

DateTime ?

Examples

Updating public properties of the loaded TGA image.

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.

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 thisinstance of Aspose.Imaging.FileFormats.Tga.TgaImage. Understanding the file format is essential forcompatibility checks and ensuring seamless integration within software systems,enabling efficient processing and manipulation of images.

public override FileFormat
    Get
    {
        get;
    }

Property Value

FileFormat

GammaValueDenominator

Retrieves the denominator part of the gamma value, an integral factor indetermining color representation within images. For images lacking gammacorrection, this value should be 1.0, ensuring accurate color rendering.Appreciating and leveraging this parameter is fundamental for upholding colorfidelity and achieving precise image visualization.

public ushort GammaValueDenominator
   {
      get;
   }

Property Value

ushort

Examples

Getting values of the public properties of the loaded TGA image.

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

GammaValueNumerator

Gets the numerator part of the gamma value, which is essential for accurate colorrepresentation in images. In images without gamma correction, this value should be1.0. Understanding and utilizing this value is crucial for maintaining colorfidelity and ensuring accurate image rendering.

public ushort GammaValueNumerator
   {
      get;
   }

Property Value

ushort

Examples

Getting values of the public properties of the loaded TGA image.

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

HasAlpha

Retrieve a boolean value indicating whether the Aspose.Imaging.FileFormats.Tga.TgaImage includes analpha channel, facilitating transparency effects. This property provides essentialinformation for handling image composition and rendering, assisting developers inimplementing diverse visual effects and compositing operations.

public override bool HasAlpha
   {
      get;
   }

Property Value

bool

Examples

Getting values of the public properties of the loaded TGA image.

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

HasBackgroundColor

Retrieves or sets a value indicating whether the image contains a backgroundcolor. This property is useful for determining whether the image includes adistinct background color separate from the foreground content. It enablesyou to customize image processing or rendering based on the presence or absence ofa background color.

public override bool HasBackgroundColor
{
    get;
    set;
}

Property Value

bool

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 interpretationand manipulation of the image’s color data.

public bool HasColorMap
   {
      get;
   }

Property Value

bool

Examples

Getting values of the public properties of the loaded TGA image.

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

HasTransparentColor

Retrieves or sets a boolean value indicating whether the image contains atransparent color. This property is essential for identifying whether the imagesupports transparency, helping you to implement appropriate handling oftransparency-related operations such as blending, compositing, or masking.

public override bool HasTransparentColor
   {
      get;
      set;
   }

Property Value

bool

Height

Obtain the height of the image encapsulated by this Aspose.Imaging.FileFormats.Tga.TgaImageinstance. This property furnishes developers with critical details concerning theimage’s vertical dimensions, enabling seamless integration and manipulation ofimages within their software solutions.

public override int Height
   {
      get;
   }

Property Value

int

Examples

Getting values of the public properties of the loaded TGA image.

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

ImageId

Gets or sets the unique identifier associated with the image. This ID serves as areference point for identifying and distinguishing the image from others within asystem or application. By setting or retrieving the Image ID, you can manage andtrack images effectively, facilitating organized image management and retrievalprocesses.

This optional field contains identifying information about the image. The maximum length for this field is 255 bytes.

public string ImageId
    {
        get;
        set;
    }

Property Value

string

Examples

Updating public properties of the loaded TGA image.

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.

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 agray-scale image. This property is crucial for distinguishing between color andgray-scale images, aiding developers in applying appropriate processing andrendering techniques based on the image’s color characteristics.

public bool IsGrayScale
   {
      get;
   }

Property Value

bool

Examples

Getting values of the public properties of the loaded TGA image.

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

JobNameOrId

Retrieves or sets the job name or ID associated with the image. This propertyenables you to access or modify metadata related to the specific job or projectassociated with the image. By utilizing the Job Name/ID property, users can easilyidentify the project or task to which the image pertains, facilitatingorganization and management of image assets within larger workflows or projects.

public string JobNameOrId
   {
      get;
      set;
   }

Property Value

string

Examples

Updating public properties of the loaded TGA image.

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.

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 tothe specific job or project associated with the image.

public TimeSpan? JobTime
   {
      get;
      set;
   }

Property Value

TimeSpan ?

Examples

Updating public properties of the loaded TGA image.

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.

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 indetermining the visual aspect of pixels within the image. This value is essentialfor preserving accurate pixel representation and aspect ratios throughout variousimage rendering and processing operations, ensuring high-quality visual output.

public ushort PixelAspectRatioDenominator
   {
      get;
   }

Property Value

ushort

Examples

Getting values of the public properties of the loaded TGA image.

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

PixelAspectRatioNumerator

Retrieves the numerator component of the Pixel Aspect Ratio, which influences thevisual aspect of pixels within the image. Understanding and manipulating thisvalue is essential for achieving accurate pixel representation and aspect ratiosin image rendering and processing.

public ushort PixelAspectRatioNumerator
   {
      get;
   }

Property Value

ushort

Examples

Getting values of the public properties of the loaded TGA image.

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

SoftwareId

Manages the software identification (ID) associated with the image, allowing forup to 40 ASCII characters. This property serves as a means to uniquely identifythe software utilized in creating or processing the image, providing valuablemetadata for organizational and informational purposes.

public string SoftwareId
    {
        get;
        set;
    }

Property Value

string

Examples

Updating public properties of the loaded TGA image.

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.

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 acceptedlength for the version string is typically 3 to 4 characters. This property isuseful for tracking the software used to create or manipulate the image and canprovide valuable context for image processing and compatibility checks.

public string SoftwareVersion
{
    get;
    set;
}

Property Value

string

Examples

Updating public properties of the loaded TGA image.

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.

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 theimage. This property represents an additional detail within the software versionstring and can be useful for finer version differentiation.

public char SoftwareVersionLetter
    {
        get;
        set;
    }

Property Value

char

Examples

Updating public properties of the loaded TGA image.

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.

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 withthe image. This property represents the numerical part of the software versionstring, providing important information about the version of the software used tocreate or modify the image.

public ushort SoftwareVersionNumber
    {
        get;
        set;
    }

Property Value

ushort

Examples

Updating public properties of the loaded TGA image.

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.

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 allowsyou to access or modify the color designated as the key color for specific imageprocessing tasks or effects. Utilizing the Key Color property enables users toapply color-based operations such as chroma keying or color replacement, enhancingimage 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

Color

Examples

Updating public properties of the loaded TGA image.

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.

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.TgaImageinstance. This property provides developers with essential information about theimage dimensions, facilitating various image manipulation and processing taskswithin their software applications.

public override int Width
    {
        get;
    }

Property Value

int

Examples

Getting values of the public properties of the loaded TGA image.

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

XOrigin

Gets or sets absolute horizontal coordinate for the lower left corner of the imageas it is positioned on a display device having an origin at the lower left of thescreen(e.g., the TARGA series).

public ushort XOrigin
    {
        get;
        set;
    }

Property Value

ushort

Examples

Updating public properties of the loaded TGA image.

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.

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 imageas it is positioned on a display device having an origin at the lower left of thescreen(e.g., the TARGA series).

public ushort YOrigin
    {
        get;
        set;
    }

Property Value

ushort

Examples

Updating public properties of the loaded TGA image.

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.

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 clonesall attributes and properties of the original. This method facilitates thecreation of identical copies, ensuring data integrity and preserving the state ofthe current instance without affecting the original object.

public TgaImage Clone()
{
    var clonedTgaImage = new TgaImage();
    return clonedTgaImage;
}

Returns

TgaImage

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 anew instance with identical attributes. This operation ensures the preservationof data integrity and facilitates the duplication of image properties withoutaltering 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 arectangular area within the image to retain, discarding the rest. This operationis useful for focusing on specific content within the image or removing unwantedportions.

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 bottomboundaries. This method allows you to trim the image by moving its boundariesindependently along the horizontal and vertical axes. By adjusting these shifts,you can precisely control which portions of the image to retain, effectivelycropping 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 currentAspose.Imaging.FileFormats.Tga.TgaImage instance is equal to the second image provided as aparameter. This operation facilitates determining if two TGA images areidentical, aiding in image processing and comparison tasks.

public bool Equals(TgaImage other)
    {
    }
In this case, since the given code already follows standard C# conventions for indentation and spacing, no changes are needed.

Parameters

other TgaImage

Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.

Returns

bool

Comparison results.

Equals(object)

The method performs an equality comparison between the currentAspose.Imaging.FileFormats.Tga.TgaImage instance and another object provided as a parameter.Specifically, it evaluates whether the properties of the current image matchthose of the second object, assisting in determining their equivalence forcomparison purposes within image processing workflows.

public override bool Equals(object other)
{
    if (other == null || this.GetType() != other.GetType())
        return false;
    var obj = (YourType)other;
    if (this.yourFieldsHere != obj.yourFieldsHere)
        return false;
    return true;
}

Parameters

other object

Second Aspose.Imaging.FileFormats.Tga.TgaImage that takes part in comparison.

Returns

bool

Comparison results.

GetHashCode()

Retrieve the hash code of the current instance. However, it’s important to notethat this hash code may not be suitable for use as a key, particularly becauseinstances of the TgaImage class are not immutable.

public override int GetHashCode()
   {
   }

Returns

int

Hash code of this instance.

Resize(int, int, ImageResizeSettings)

Resize the image while applying specific settings to maintain the desireddimensions and aspect ratio. By customizing image settings, you can effectivelyresize the image while ensuring optimal visual quality and compatibility withdifferent 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 howthe resizing operation is performed. This method provides flexibility in resizingimages according to different algorithms or techniques. By choosing theappropriate resize type, you can achieve the desired balance between imagequality 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 resizeproportionality and preserving the background color. This method allows forprecise image manipulation, ensuring that the rotation maintains visual balanceand consistency with the specified background color. It’s ideal for tasks whereaccurate rotation around the center is necessary, such as orientation correctionor 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 changedaccording to rotated rectangle (corner points) projections in othercase that leaves dimensions untouched and onlyinternal image contents are rotated.

backgroundColor Color

Color of the background.

RotateFlip(RotateFlipType)

The “RotateFlip” method enables rotating and flipping operations on the image. Itoffers versatile functionality for manipulating image orientation, allowing usersto perform rotations and flips according to their requirements, facilitatingefficient 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 thefirst and second images involved in the comparison process. This methodfacilitates straightforward assessment of image equality, ensuring accurateanalysis and decision-making within image processing workflows.

public static bool operator ==(TgaImage first, TgaImage second)
{
    if (ReferenceEquals(first, null))
        return ReferenceEquals(second, null);
    if (ReferenceEquals(second, null))
        return false;
    return first.Header == second.Header &&
           first.Width == second.Width &&
           first.Height == second.Height &&
           first.ImageType == second.ImageType &&
           Enumerable.Range(0, first.Width * first.Height * 3)
               .All(i => first.Pixels[i] == second.Pixels[i]);
}

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

bool

Comparison results.

operator !=(TgaImage, TgaImage)

Conducts a non-equality comparison between two TGA images, evaluating both thefirst and second images involved in the comparison. This method aids inidentifying discrepancies or differences between images, enabling preciseanalysis and decision-making in image processing tasks.

public static bool operator!= (TgaImage first, TgaImage second)
I've indented the operator keyword and its parameter list to match the standard C# convention. Additionally, I've added a single space after the opening parenthesis of the method signature for better readability.

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

bool

Comparison results.

 English