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.
Saving of the JPG image as a TGA image.
try (Image image = Image.load("test.jpg"))
{
image.save("test.tga", new TgaOptions());
}
| Constructor and Description |
|---|
TgaImage(InputStream stream)
Initialize a new instance of the
TgaImage class using a stream to
load the image. |
TgaImage(RasterImage rasterImage)
Create a new instance of the
TgaImage class by providing a raster
image object. |
TgaImage(String path)
Initializes a new
TgaImage object using the provided file path for
loading the image content. |
| Modifier and Type | Method and Description |
|---|---|
void |
crop(int leftShift,
int rightShift,
int topShift,
int bottomShift)
Crop the image by specifying shifts for the left, right, top, and bottom
boundaries.
|
void |
crop(Rectangle rectangle)
Crop the image to a specified region.
|
TgaImage |
deepClone()
Produces a duplicate of the current instance, generating a new object that clones
all attributes and properties of the original.
|
void |
deepClone(TgaImage tgaImage)
Replicate the properties of another
TgaImage object, creating a
new instance with identical attributes. |
boolean |
equals(Object other)
The method performs an equality comparison between the current
TgaImage instance and another object provided as a parameter. |
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. |
String |
getAuthorComments()
Retrieves or sets the comments provided by the author of the image.
|
String |
getAuthorName()
Retrieves or sets the name of the author associated with the image.
|
Color |
getBackgroundColor()
Retrieves or sets the background color of the image.
|
int |
getBitsPerPixel()
Retrieve the bits per pixel value, providing essential information about the
image's color depth.
|
int |
getBytesPerPixel()
Obtain the bytes per pixel value, which denotes the amount of memory occupied by
each pixel in the image.
|
Date |
getDateTimeStamp()
Gets Date/Time Stamp.
|
long |
getFileFormat()
Get crucial information about the file format of the image represented by this
instance of
TgaImage. |
int |
getGammaValueDenominator()
Retrieves the denominator part of the gamma value, an integral factor in
determining color representation within images.
|
int |
getGammaValueNumerator()
Gets the numerator part of the gamma value, which is essential for accurate color
representation in images.
|
int |
getHeight()
Obtain the height of the image encapsulated by this
TgaImage
instance. |
String |
getImageId()
Gets the unique identifier associated with the image.
|
String |
getJobNameOrId()
Retrieves or sets the job name or ID associated with the image.
|
Date |
getJobTime()
Retrieves or sets the timestamp indicating the job time associated with the image.
|
int |
getPixelAspectRatioDenominator()
Retrieves the denominator part of the Pixel Aspect Ratio, a crucial factor in
determining the visual aspect of pixels within the image.
|
int |
getPixelAspectRatioNumerator()
Retrieves the numerator component of the Pixel Aspect Ratio, which influences the
visual aspect of pixels within the image.
|
String |
getSoftwareId()
Manages the software identification (ID) associated with the image, allowing for
up to 40 ASCII characters.
|
String |
getSoftwareVersion()
Retrieves or sets the software version associated with the image.
|
char |
getSoftwareVersionLetter()
Retrieves or sets the letter component of the software version associated with the
image.
|
int |
getSoftwareVersionNumber()
Retrieves or sets the numeric component of the software version associated with
the image.
|
Color |
getTransparentColor()
Retrieves or sets the key color associated with the image.
|
int |
getWidth()
Retrieve the width of the image represented by this
TgaImage
instance. |
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).
|
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).
|
boolean |
hasAlpha()
Retrieve a boolean value indicating whether the
TgaImage includes an
alpha channel, facilitating transparency effects. |
boolean |
hasBackgroundColor()
Retrieves or sets a value indicating whether the image contains a background
color.
|
boolean |
hasColorMap()
Retrieve whether this
TgaImage instance contains a color map. |
int |
hashCode()
Retrieve the hash code of the current instance.
|
boolean |
hasTransparentColor()
Retrieves or sets a boolean value indicating whether the image contains a
transparent color.
|
boolean |
isGrayScale()
Obtain a boolean value indicating whether the
TgaImage represents a
gray-scale image. |
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.
|
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.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resize the image while applying specific settings to maintain the desired
dimensions and aspect ratio.
|
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.
|
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.
|
void |
rotateFlip(int rotateFlipType)
The "rotateFlip" method enables rotating and flipping operations on the image.
|
void |
setAuthorComments(String value)
Retrieves or sets the comments provided by the author of the image.
|
void |
setAuthorName(String value)
Retrieves or sets the name of the author associated with the image.
|
void |
setBackgroundColor(boolean value)
Retrieves or sets a value indicating whether the image contains a background
color.
|
void |
setBackgroundColor(Color value)
Retrieves or sets the background color of the image.
|
void |
setDateTimeStamp(Date value)
Sets Date/Time Stamp.
|
void |
setImageId(String value)
Sets the unique identifier associated with the image.
|
void |
setJobNameOrId(String value)
Retrieves or sets the job name or ID associated with the image.
|
void |
setJobTime(Date value)
Retrieves or sets the timestamp indicating the job time associated with the image.
|
void |
setSoftwareId(String value)
Manages the software identification (ID) associated with the image, allowing for
up to 40 ASCII characters.
|
void |
setSoftwareVersion(String value)
Retrieves or sets the software version associated with the image.
|
void |
setSoftwareVersionLetter(char value)
Retrieves or sets the letter component of the software version associated with the
image.
|
void |
setSoftwareVersionNumber(int value)
Retrieves or sets the numeric component of the software version associated with
the image.
|
void |
setTransparentColor(boolean value)
Retrieves or sets a boolean value indicating whether the image contains a
transparent color.
|
void |
setTransparentColor(Color value)
Retrieves or sets the key color associated with the image.
|
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).
|
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).
|
adjustBrightness, adjustContrast, adjustGamma, adjustGamma, analyzePercentageDigitalSignature, autoBrightnessContrast, binarizeBradley, binarizeBradley, binarizeFixed, binarizeOtsu, blend, cacheData, dither, embedDigitalSignature, grayscale, isCached, isDigitalSigned, normalizeHistogramautoRotate, blend, blend, blend, dither, filter, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getImageOpacity, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getSkewAngle, getUpdateXmpData, getUseRawData, getVerticalResolution, isDigitalSigned, isRawDataAvailable, isUsePalette, loadArgb32Pixels, loadArgb64Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialArgb64Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, normalizeAngle, normalizeAngle, readArgb32ScanLine, readScanLine, removeMetadata, replaceColor, replaceColor, replaceNonTransparentColors, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setUpdateXmpData, setUseRawData, setVerticalResolution, toBitmap, writeArgb32ScanLine, writeScanLinecanLoad, canLoad, canLoad, canLoad, canSave, create, create, create, create, create, create, create, getBounds, getBufferSizeHint, getContainer, getDefaultOptions, getExifData, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getIProgressEventHandler, getMetadata, getOriginalOptions, getPalette, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSerializedStream, getSize, getXmpData, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, save, setAutoAdjustPalette, setBufferSizeHint, setExifData, setInterruptMonitor, setPalette, setXmpData, trySetMetadatagetDataStreamContainer, save, save, saveclose, dispose, getDisposedgetClass, notify, notifyAll, toString, wait, wait, waitgetXmpData, setXmpDatapublic 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.
path - The path to load an image.com.aspose.ms.System.ArgumentNullException - Specified path is null.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.
rasterImage - The raster image.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.
stream - The stream to load an image.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.
getBitsPerPixel in class Imagepublic 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
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.
hasAlpha in class RasterImageTgaImage has an alpha channel.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.
TgaImage is gray-scale.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.
getWidth in interface IObjectWithBoundsgetWidth in class Imagepublic 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.
getHeight in interface IObjectWithBoundsgetHeight in class Imagepublic 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.
getFileFormat in class ImageTgaImage.FileFormatpublic 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.
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.
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.
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.
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.
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).
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).
value - 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.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");
}
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).
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).
value - 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.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");
}
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.
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.
value - the unique identifier associated with the image.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.
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.
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).
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).
value - Author Name.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.
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.
value - Date/Time Stamp.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");
}
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.
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.
value - Job Name/ID.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.
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.
value - Job Time.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");
}
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 ‘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.
getTransparentColor in class RasterImagepublic 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 ‘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.
setTransparentColor in class RasterImagevalue - Key Color.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");
}
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.
hasTransparentColor in class RasterImagepublic 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.
setTransparentColor in class RasterImagevalue - a value indicating whether the image has transparent color.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.
getBackgroundColor in class Imagepublic 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.
setBackgroundColor in class Imagevalue - the background color.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.
hasBackgroundColor in class Imagepublic 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.
setBackgroundColor in class Imagevalue - a value indicating whether the image has background color.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.
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.
value - Software Version.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.
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.
value - Software Version letter part.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");
}
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.
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.
value - Software Version number part.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");
}
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.
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.
value - Software ID.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.
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.
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.
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.
tgaImage - Other TgaImagepublic 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.
other - Second TgaImage that takes part in comparison.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.
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.
rotateFlip in class RasterCachedImagerotateFlipType - The rotation flip type.RotateFlipTypepublic 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.
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.
crop in class RasterCachedImagerectangle - The rectangle.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.
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.
resize in class RasterCachedImagenewWidth - The new width.newHeight - The new height.settings - The resize settings.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.
resize in class RasterCachedImagenewWidth - The new width.newHeight - The new height.resizeType - The resize type.ResizeTypepublic 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.
rotate in class RasterCachedImageangle - The rotation angle in degrees. Positive values will rotate clockwise.resizeProportionally - if set to true you will have your image size changed
according to rotated rectangle (corner points) projections in other
case that leaves dimensions untouched and only
image contents are rotated.backgroundColor - Color of the background.Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.