Aspose.Imaging for Java 21.5 - Release notes

Competitive features:

  • Support export to Dxf format in Aspose.Imaging
  • Eps can not be converted to vectorized APS (to svg for example)
  • Investigate and implement the object of the CDR - PowerClip
KeySummaryCategory
IMAGINGJAVA-7786Support export to Dxf format in Aspose.ImagingFeature
IMAGINGJAVA-7771Support of Eps export as vector to svgFeature
IMAGINGJAVA-7754Investigate and implement the object of the CDR - PowerClipFeature
IMAGINGJAVA-7769Fix exception with reading CDREnhancement
IMAGINGJAVA-7768ImageLoad exception on loading TGA imageEnhancement
IMAGINGJAVA-7767Unable to rasterize CMX imagesEnhancement
IMAGINGJAVA-7765NullReferenceException on exporting WMZ to PNGEnhancement
IMAGINGJAVA-7764GIF is not properly converted to TGAEnhancement
IMAGINGJAVA-7760Improve compression quality in 8 Bpp Indexed formatEnhancement
IMAGINGJAVA-7742Incorrect export from CDR to PNGEnhancement
IMAGINGJAVA-7741System.ArgumentOutOfRangeException while converting particular CDR to PNGEnhancement
IMAGINGJAVA-2054Problem converting TIFF to JPG after upgrading Aspose libraryEnhancement
IMAGINGJAVA-2032Exception on saving EMF to PDFEnhancement

Public API changes:

Added APIs:

Please see corresponding cumulative API changes for Aspose.Imaging for .NET 21.5 version

Removed APIs:

Please see corresponding cumulative API changes for Aspose.Imaging for .NET 21.5 version

Usage Examples:

IMAGINGJAVA-7786 Support export to Dxf format in Aspose.Imaging

String inputFileName = "Pooh group.eps";
String outputFilePath = "result.dxf";
try (Image image = Image.load(inputFilePath))
{
     DxfOptions options = new DxfOptions();
     options.setTextAsLines(true);
     options.setConvertTextBeziers(true);
     options.setBezierPointCount(20);
     image.save(outputFilePath, options);
}

IMAGINGJAVA-7771 Eps can not be converted to vectorized APS (to svg for example)

String fileName = "Pooh group.eps";
String baseFolder = "D:\\";
String inputFileName = baseFolder + fileName;
String outputFile = inputFileName + ".svg";
try (EpsImage image = (EpsImage)Image.load(inputFileName))
{
    image.save(outputFile, new SvgOptions());
}

IMAGINGJAVA-7769 Fix exception with reading CDR

java
String baseFolder = "D:\\cdr\\";
String[] files = new String[] { "book work_1to19.cdr", "Backup_of_PTERR.cdr", "PTERR.cdr", "PTERR_2.cdr", "VECTOR SSV.cdr" };
int[] positioning = new int[]
		{
				PositioningTypes.DefinedByDocument, PositioningTypes.DefinedByDocument, PositioningTypes.DefinedByDocument,
				PositioningTypes.DefinedByDocument, PositioningTypes.Relative
		};

for (int i = 0; i < files.length; i++)
{
	String fileName = files[i];
	String inputFilePath = baseFolder + fileName;
	String outputFilePath = inputFilePath + ".png";
	try (CdrImage image = (CdrImage)Image.load(inputFilePath))
	{
		CdrRasterizationOptions vector = new CdrRasterizationOptions();
		vector.setPositioning(positioning[i]);
		final PngOptions options = new PngOptions();
		options.setVectorRasterizationOptions(vector);
		image.save(outputFilePath, options);
	}
}

IMAGINGJAVA-7768 ImageLoad exception on loading TGA image

try (TgaImage image = (TgaImage)Image.load("GoldBorder.tga"))
{
    image.save("output.tga.png", new PngOptions() {{ setColorType(PngColorType.TruecolorWithAlpha); }});
}

IMAGINGJAVA-7767 Unable to rasterize CMX images

String baseFolder = "D:\\cmx\\";
String[] files = new string[] { "App police cmx.cmx", "amc- sky ways travels.cmx"};
for (String fileName : files)
{
    String inputFilePath = baseFolder + fileName;
    String outputFilePath = inputFilePath + ".png";
    try (Image image = Image.load(inputFilePath))
    {
         image.save(outputFilePath, new PngOptions());
    }
}

IMAGINGJAVA-7765 NullReferenceException on exporting WMZ to PNG

String basePath = "D:\\";
String fileName = "image009.wmz";
String inputFileName = basePath + fileName;
String outFileName = inputFileName + ".png";
try (Image image = Image.load(inputFileName))
{
   image.save(outFileName, new PngOptions());
}

IMAGINGJAVA-7764 GIF is not properly converted to TGA

try (Image image = Image.load("little-dogs.gif"))
{
    image.save("output.tga", new TgaOptions());
}

IMAGINGJAVA-7760 Improve compression quality in 8 Bpp Indexed format

try (Image image = Image.load(sourceFilePath))
{
	PngOptions options = new PngOptions();
	options.setProgressive(true);
	options.setColorType(PngColorType.IndexedColor);
	options.setCompressionLevel(9);
	options.setPalette(ColorPaletteHelper.getCloseImagePalette((RasterImage)image, 256, PaletteMiningMethod.Histogramm));
    image.save(outputFilePath, options);
}

IMAGINGJAVA-7754 Investigate and implement the object of the CDR - PowerClip

String baseFolder = "D:\\cdr\\";
String[] files = new String[] { "powerclip.cdr", "powerclip1.cdr", "powerclip2.cdr", "powerclip3.cdr"};
for (String fileName : files)
{
    String inputFilePath = baseFolder + fileName;
    String outputFilePath = inputFilePath + ".png";
    try (CdrImage image = (CdrImage) Image.load(inputFilePath))
    {
         image.save(outputFilePath, new PngOptions());
    }
}

IMAGINGJAVA-7742 Incorrect export from CDR to PNG

String baseFolder = "D:\\";
String fileName = "GSTSK_Banner.cdr";
String inputFilePath = baseFolder + fileName;
String outputFilePath = inputFilePath + ".png";
try (Image image = Image.load(inputFilePath))
{
    CdrRasterizationOptions rasterizationOptions = new CdrRasterizationOptions();
	rasterizationOptions.setPositioning(PositioningTypes.DefinedByDocument);

    PngOptions pngOptions = new PngOptions();
    pngOptions.setVectorRasterizationOptions(rasterizationOptions);

    image.save(outputFilePath, pngOptions);
}

IMAGINGJAVA-7741 System.ArgumentOutOfRangeException while converting particular CDR to PNG

String baseFolder = "D:\\cdr\\";
String fileName = "Font error.cdr";
String inputFilePath = baseFolder + fileName;
String outputFilePath = inputFilePath + ".png";
try (Image image = Image.load(inputFilePath))
{
  image.save(outputFilePath, new PngOptions());
}

IMAGINGJAVA-2054 Problem converting TIFF to JPG after upgrading Aspose library

java
java.util.List<byte[]> originalJpegs = new ArrayList<byte[]>();
String originalTiffImage = "multiPage.tiff";
TiffImage tiffImage = (TiffImage) TiffImage.load( originalTiffImage );
try
{
	for (TiffFrame frame : tiffImage.getFrames() )
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		JpegImage jImage = new JpegImage( frame );
		jImage.save( baos );
		jImage.close();
		byte[] jImageBytes = baos.toByteArray();
		originalJpegs.add( jImageBytes );
	}
}
finally
{
	tiffImage.dispose();
}

IMAGINGJAVA-2032 Exception on saving EMF to PDF

String f = "sample.emf";

try
{
	Image document = Image.load(f);
	PdfOptions options = new PdfOptions();
	document.save(f + ".pdf", options);
	document.close();
}
catch (ImageLoadException e)
{
	if (!e.getMessage().equals("Cannot open an image. The image size can not be 0!"))
		throw e;
}

System.out.println("Everything is OK!");