Manipulating TGA Images

Truevision TGA, often referred to as TARGA, is a raster graphics file format created by Truevision Inc. (now part of Avid Technology). It was the native format of TARGA and VISTA boards, which were the first graphic cards for IBM-compatible PCs to support Highcolor/truecolor display. This family of graphic cards was intended for professional computer image synthesis and video editing with PCs; for this reason, usual resolutions of TGA image files match those of the NTSC and PAL video formats

Convert JPG to TGA

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

Convert Png to TGA

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

Save to TGA

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, Calendar.JANUARY, 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");
}