TgaImage

Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.DataStreamSupporter, com.aspose.imaging.Image, com.aspose.imaging.RasterImage, com.aspose.imaging.RasterCachedImage

public class TgaImage extends RasterCachedImage

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.

Constructors

ConstructorDescription
TgaImage(String path)Initializes a new TgaImage object using the provided file path for loading the image content.
TgaImage(RasterImage rasterImage)Create a new instance of the TgaImage class by providing a raster image object.
TgaImage(InputStream stream)Initialize a new instance of the TgaImage class using a stream to load the image.

Methods

MethodDescription
getBitsPerPixel()Retrieve the bits per pixel value, providing essential information about the image’s color depth.
getBytesPerPixel()Obtain the bytes per pixel value, which denotes the amount of memory occupied by each pixel in the image.
hasAlpha()Retrieve a boolean value indicating whether the TgaImage includes an alpha channel, facilitating transparency effects.
isGrayScale()Obtain a boolean value indicating whether the TgaImage represents a gray-scale image.
getWidth()Retrieve the width of the image represented by this TgaImage instance.
getHeight()Obtain the height of the image encapsulated by this TgaImage instance.
getFileFormat()Get crucial information about the file format of the image represented by this instance of TgaImage.
hasColorMap()Retrieve whether this TgaImage instance contains a color map.
getGammaValueNumerator()Gets the numerator part of the gamma value, which is essential for accurate color representation in images.
getGammaValueDenominator()Retrieves the denominator part of the gamma value, an integral factor in determining color representation within images.
getPixelAspectRatioNumerator()Retrieves the numerator component of the Pixel Aspect Ratio, which influences the visual aspect of pixels within the image.
getPixelAspectRatioDenominator()Retrieves the denominator part of the Pixel Aspect Ratio, a crucial factor in determining the visual aspect of pixels within the image.
getXOrigin()Gets 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).
setXOrigin(int value)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).
getYOrigin()Gets 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).
setYOrigin(int value)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).
getImageId()Gets the unique identifier associated with the image.
setImageId(String value)Sets the unique identifier associated with the image.
getAuthorComments()Retrieves or sets the comments provided by the author of the image.
setAuthorComments(String value)Retrieves or sets the comments provided by the author of the image.
getAuthorName()Retrieves or sets the name of the author associated with the image.
setAuthorName(String value)Retrieves or sets the name of the author associated with the image.
getDateTimeStamp()Gets Date/Time Stamp.
setDateTimeStamp(Date value)Sets Date/Time Stamp.
getJobNameOrId()Retrieves or sets the job name or ID associated with the image.
setJobNameOrId(String value)Retrieves or sets the job name or ID associated with the image.
getJobTime()Retrieves or sets the timestamp indicating the job time associated with the image.
setJobTime(Date value)Retrieves or sets the timestamp indicating the job time associated with the image.
getTransparentColor()Retrieves or sets the key color associated with the image.
setTransparentColor(Color value)Retrieves or sets the key color associated with the image.
hasTransparentColor()Retrieves or sets a boolean value indicating whether the image contains a transparent color.
setTransparentColor(boolean value)Retrieves or sets a boolean value indicating whether the image contains a transparent color.
getBackgroundColor()Retrieves or sets the background color of the image.
setBackgroundColor(Color value)Retrieves or sets the background color of the image.
hasBackgroundColor()Retrieves or sets a value indicating whether the image contains a background color.
setBackgroundColor(boolean value)Retrieves or sets a value indicating whether the image contains a background color.
getSoftwareVersion()Retrieves or sets the software version associated with the image.
setSoftwareVersion(String value)Retrieves or sets the software version associated with the image.
getSoftwareVersionLetter()Retrieves or sets the letter component of the software version associated with the image.
setSoftwareVersionLetter(char value)Retrieves or sets the letter component of the software version associated with the image.
getSoftwareVersionNumber()Retrieves or sets the numeric component of the software version associated with the image.
setSoftwareVersionNumber(int value)Retrieves or sets the numeric component of the software version associated with the image.
getSoftwareId()Manages the software identification (ID) associated with the image, allowing for up to 40 ASCII characters.
setSoftwareId(String value)Manages the software identification (ID) associated with the image, allowing for up to 40 ASCII characters.
op_Equality(TgaImage first, TgaImage second)Performs an equality comparison between two TGA images, considering both the first and second images involved in the comparison process.
op_Inequality(TgaImage first, TgaImage second)Conducts a non-equality comparison between two TGA images, evaluating both the first and second images involved in the comparison.
deepClone()Produces a duplicate of the current instance, generating a new object that clones all attributes and properties of the original.
deepClone(TgaImage tgaImage)Replicate the properties of another TgaImage object, creating a new instance with identical attributes.
equals(TgaImage other)In an equality comparison, the method evaluates whether the current TgaImage instance is equal to the second image provided as a parameter.
equals(Object other)The method performs an equality comparison between the current TgaImage instance and another object provided as a parameter.
rotateFlip(int rotateFlipType)The “rotateFlip” method enables rotating and flipping operations on the image.
hashCode()Retrieve the hash code of the current instance.
crop(Rectangle rectangle)Crop the image to a specified region.
crop(int leftShift, int rightShift, int topShift, int bottomShift)Crop the image by specifying shifts for the left, right, top, and bottom boundaries.
resize(int newWidth, int newHeight, ImageResizeSettings settings)Resize the image while applying specific settings to maintain the desired dimensions and aspect ratio.
resize(int newWidth, int newHeight, int resizeType)Adjusts the size of the image using a specified resize type, which determines how the resizing operation is performed.
rotate(float angle, boolean resizeProportionally, Color backgroundColor)Rotates the image around its center by a specified angle while maintaining resize proportionality and preserving the background color.

Example: Saving of the JPG image as a TGA image.

try (Image image = Image.load("test.jpg"))
{
    image.save("test.tga", new TgaOptions());
}

Example: Loading of the PNG image, conversion of it to the TgaImage and saving as a TGA image.

try (RasterImage image = (RasterImage)Image.load("test.png"))
{
    try (TgaImage tgaImage = new TgaImage(image))
    {
        tgaImage.save("test.tga");
    }
}

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

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    Date dateTimeStamp = image.getDateTimeStamp();
    String authorName = image.getAuthorName();
    String authorComments = image.getAuthorComments();
    String imageId = image.getImageId();
    String jobNameOrId = image.getJobNameOrId();
    Date jobTime = image.getJobTime();
    Color keyColor = image.getTransparentColor();
    String softwareId = image.getSoftwareId();
    String softwareVersion = image.getSoftwareVersion();
    char softwareVersionLetter = image.getSoftwareVersionLetter();
    int softwareVersionNumber = image.getSoftwareVersionNumber();
    int xOrigin = image.getXOrigin();
    int yOrigin = image.getYOrigin();
    int gammaValueDenominator = image.getGammaValueDenominator();
    int gammaValueNumerator = image.getGammaValueNumerator();
    boolean hasAlphaChannel = image.hasAlpha();
    boolean hasColorMap = image.hasColorMap();
    int height = image.getHeight();
    boolean isGrayScale = image.isGrayScale();
    int pixelAspectRatioDenominator = image.getPixelAspectRatioDenominator();
    int pixelAspectRatioNumerator = image.getPixelAspectRatioNumerator();
    Size size = image.getSize();
    int width = image.getWidth();
}

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

TgaImage(String path)

public TgaImage(String path)

Initializes a new 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.

Parameters:

ParameterTypeDescription
pathjava.lang.StringThe path to load an image.

TgaImage(RasterImage rasterImage)

public TgaImage(RasterImage rasterImage)

Create a new instance of the 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.

Parameters:

ParameterTypeDescription
rasterImageRasterImageThe raster image.

Example: Loading of the PNG image, conversion of it to the TgaImage and saving as a TGA image.

try (RasterImage image = (RasterImage)Image.load("test.png"))
{
    try (TgaImage tgaImage = new TgaImage(image))
    {
        tgaImage.save("test.tga");
    }
}

TgaImage(InputStream stream)

public TgaImage(InputStream stream)

Initialize a new instance of the 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.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe stream to load an image.

getBitsPerPixel()

public int getBitsPerPixel()

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.

Returns: int - bits per pixel.

getBytesPerPixel()

public final int getBytesPerPixel()

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

Returns: int - bytes per pixel.

hasAlpha()

public boolean hasAlpha()

Retrieve a boolean value indicating whether the 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.

Returns: boolean - a value indicating whether this TgaImage has an alpha channel.

isGrayScale()

public final boolean isGrayScale()

Obtain a boolean value indicating whether the 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.

Returns: boolean - a value indicating whether this TgaImage is gray-scale.

getWidth()

public int getWidth()

Retrieve the width of the image represented by this TgaImage instance. This property provides developers with essential information about the image dimensions, facilitating various image manipulation and processing tasks within their software applications.

Returns: int - this image width in pixels.

getHeight()

public int getHeight()

Obtain the height of the image encapsulated by this 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.

Returns: int - this image height in pixels.

getFileFormat()

public long getFileFormat()

Get crucial information about the file format of the image represented by this instance of TgaImage. Understanding the file format is essential for compatibility checks and ensuring seamless integration within software systems, enabling efficient processing and manipulation of images.

Returns: long - crucial information about the file format of the image represented by this instance of TgaImage.

hasColorMap()

public final boolean hasColorMap()

Retrieve whether this 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.

Returns: boolean - a value indicating whether this image has color map.

getGammaValueNumerator()

public final int getGammaValueNumerator()

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.

Returns: int - the numerator part of the gamma value, which is essential for accurate color representation in images.

getGammaValueDenominator()

public final int getGammaValueDenominator()

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.

Returns: int

getPixelAspectRatioNumerator()

public final int getPixelAspectRatioNumerator()

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.

Returns: int

getPixelAspectRatioDenominator()

public final int getPixelAspectRatioDenominator()

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.

Returns: int

getXOrigin()

public final int getXOrigin()

Gets 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).

Returns: int - 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.

setXOrigin(int value)

public final void setXOrigin(int value)

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).

Parameters:

ParameterTypeDescription
valueintabsolute 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.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getYOrigin()

public final int getYOrigin()

Gets 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).

Returns: int - 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.

setYOrigin(int value)

public final void setYOrigin(int value)

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).

Parameters:

ParameterTypeDescription
valueintabsolute 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.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getImageId()

public final String getImageId()

Gets 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.

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

Returns: java.lang.String - the unique identifier associated with the image.

setImageId(String value)

public final void setImageId(String value)

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.

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

Parameters:

ParameterTypeDescription
valuejava.lang.Stringthe unique identifier associated with the image.

getAuthorComments()

public final String getAuthorComments()

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.

Returns: java.lang.String

setAuthorComments(String value)

public final void setAuthorComments(String value)

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.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getAuthorName()

public final String getAuthorName()

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).

Returns: java.lang.String

setAuthorName(String value)

public final void setAuthorName(String value)

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).

Parameters:

ParameterTypeDescription
valuejava.lang.StringAuthor Name.

getDateTimeStamp()

public final Date getDateTimeStamp()

Gets 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.

Returns: java.util.Date - Date/Time Stamp.

setDateTimeStamp(Date value)

public final void setDateTimeStamp(Date value)

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.

Parameters:

ParameterTypeDescription
valuejava.util.DateDate/Time Stamp.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getJobNameOrId()

public final String getJobNameOrId()

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.

Returns: java.lang.String - Job Name/ID.

setJobNameOrId(String value)

public final void setJobNameOrId(String value)

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.

Parameters:

ParameterTypeDescription
valuejava.lang.StringJob Name/ID.

getJobTime()

public final Date getJobTime()

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.

Returns: java.util.Date - Job Time.

setJobTime(Date value)

public final void setJobTime(Date value)

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.

Parameters:

ParameterTypeDescription
valuejava.util.DateJob Time.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getTransparentColor()

public Color getTransparentColor()

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 \u2018background color\u2019 or \u2018transparent color\u2019. This is the color of the \u2018non image\u2019 area of the screen, and the same color that the screen would be cleared to if erased in the application.

Returns: Color - Key Color.

setTransparentColor(Color value)

public void setTransparentColor(Color value)

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 \u2018background color\u2019 or \u2018transparent color\u2019. This is the color of the \u2018non image\u2019 area of the screen, and the same color that the screen would be cleared to if erased in the application.

Parameters:

ParameterTypeDescription
valueColorKey Color.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

hasTransparentColor()

public boolean 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.

Returns: boolean - a value indicating whether the image has transparent color.

setTransparentColor(boolean value)

public void setTransparentColor(boolean value)

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.

Parameters:

ParameterTypeDescription
valuebooleana value indicating whether the image has transparent color.

getBackgroundColor()

public Color getBackgroundColor()

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.

Returns: Color - the background color.

setBackgroundColor(Color value)

public void setBackgroundColor(Color value)

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.

Parameters:

ParameterTypeDescription
valueColorthe background color.

hasBackgroundColor()

public boolean 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.

Returns: boolean - a value indicating whether the image has background color.

setBackgroundColor(boolean value)

public void setBackgroundColor(boolean value)

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.

Parameters:

ParameterTypeDescription
valuebooleana value indicating whether the image has background color.

getSoftwareVersion()

public final String getSoftwareVersion()

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.

Returns: java.lang.String - Software Version.

setSoftwareVersion(String value)

public final void setSoftwareVersion(String value)

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.

Parameters:

ParameterTypeDescription
valuejava.lang.StringSoftware Version.

getSoftwareVersionLetter()

public final char getSoftwareVersionLetter()

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.

Returns: char - Software Version letter part.

setSoftwareVersionLetter(char value)

public final void setSoftwareVersionLetter(char value)

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.

Parameters:

ParameterTypeDescription
valuecharSoftware Version letter part.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getSoftwareVersionNumber()

public final int getSoftwareVersionNumber()

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.

Returns: int - Software Version number part.

setSoftwareVersionNumber(int value)

public final void setSoftwareVersionNumber(int value)

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.

Parameters:

ParameterTypeDescription
valueintSoftware Version number part.

Example: Updating public properties of the loaded TGA image.

try (TgaImage image = (TgaImage)Image.load("test.tga"))
{
    image.setDateTimeStamp(new Date());
    image.setAuthorName("John Smith");
    image.setAuthorComments("Comment");
    image.setImageId("ImageId");
    image.setJobNameOrId("Important Job");
    image.setJobTime(new Date(0,0, 10));
    image.setTransparentColor(Color.fromArgb(123));
    image.setSoftwareId("SoftwareId");
    image.setSoftwareVersion("abc1");
    image.setSoftwareVersionLetter('a');
    image.setSoftwareVersionNumber(2);
    image.setXOrigin(1000);
    image.setYOrigin(1000);

    image.save("test.tga");
}

getSoftwareId()

public final String getSoftwareId()

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.

Returns: java.lang.String - Software ID.

setSoftwareId(String value)

public final void setSoftwareId(String value)

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.

Parameters:

ParameterTypeDescription
valuejava.lang.StringSoftware ID.

op_Equality(TgaImage first, TgaImage second)

public static boolean op_Equality(TgaImage first, TgaImage second)

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.

Parameters:

ParameterTypeDescription
firstTgaImageFirst TgaImage that takes part in comparison.
secondTgaImageSecond TgaImage that takes part in comparison.

Returns: boolean - Comparison results.

op_Inequality(TgaImage first, TgaImage second)

public static boolean op_Inequality(TgaImage first, TgaImage second)

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.

Parameters:

ParameterTypeDescription
firstTgaImageFirst TgaImage that takes part in comparison.
secondTgaImageSecond TgaImage that takes part in comparison.

Returns: boolean - Comparison results.

deepClone()

public final TgaImage deepClone()

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.

Returns: TgaImage - Returns a new object that is a copy of the current instance.

deepClone(TgaImage tgaImage)

public final void deepClone(TgaImage tgaImage)

Replicate the properties of another 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.

Parameters:

ParameterTypeDescription
tgaImageTgaImageOther TgaImage

equals(TgaImage other)

public final boolean equals(TgaImage other)

In an equality comparison, the method evaluates whether the current 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.

Parameters:

ParameterTypeDescription
otherTgaImageSecond TgaImage that takes part in comparison.

Returns: boolean - Comparison results.

equals(Object other)

public boolean equals(Object other)

The method performs an equality comparison between the current 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.

Parameters:

ParameterTypeDescription
otherjava.lang.ObjectSecond TgaImage that takes part in comparison.

Returns: boolean - Comparison results.

rotateFlip(int rotateFlipType)

public void rotateFlip(int 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.

Parameters:

ParameterTypeDescription
rotateFlipTypeintThe rotation flip type.

hashCode()

public int hashCode()

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.

Returns: int - Hash code of this instance.

crop(Rectangle rectangle)

public void crop(Rectangle 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.

Parameters:

ParameterTypeDescription
rectangleRectangleThe rectangle.

crop(int leftShift, int rightShift, int topShift, int bottomShift)

public void crop(int leftShift, int rightShift, int topShift, int bottomShift)

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.

Parameters:

ParameterTypeDescription
leftShiftintThe left shift.
rightShiftintThe right shift.
topShiftintThe top shift.
bottomShiftintThe bottom shift.

resize(int newWidth, int newHeight, ImageResizeSettings settings)

public void resize(int newWidth, int newHeight, ImageResizeSettings settings)

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.

Parameters:

ParameterTypeDescription
newWidthintThe new width.
newHeightintThe new height.
settingsImageResizeSettingsThe resize settings.

resize(int newWidth, int newHeight, int resizeType)

public void resize(int newWidth, int newHeight, 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.

Parameters:

ParameterTypeDescription
newWidthintThe new width.
newHeightintThe new height.
resizeTypeintThe resize type.

rotate(float angle, boolean resizeProportionally, Color backgroundColor)

public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)

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.

Parameters:

ParameterTypeDescription
anglefloatThe rotation angle in degrees. Positive values will rotate clockwise.
resizeProportionallybooleanif 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 `` image contents are rotated.
backgroundColorColorColor of the background.