Browse our Products

Aspose.Imaging for Java 19.3 - Release Notes

KeySummaryCategory
IMAGINGJAVA-1221Optimize JPEG2000 memory usage if possibleEnhancement
IMAGINGJAVA-1222Fix CMX image disposal error when loading from streamEnhancement
IMAGINGJAVA-1223Fix CMX FileFormat: it’s set to Undefined instead of CMXEnhancement
IMAGINGJAVA-1161Incorrect converting EMF to PNGBug
IMAGINGJAVA-1114DNG to JPEG conversion failsBug
IMAGINGJAVA-1210CopyFrame lost XMP metadataBug
IMAGINGJAVA-1137Exception on converting EMF to PNGBug
IMAGINGJAVA-1076Color radiance is lost for generated SVG in IEBug
IMAGINGJAVA-1149 SVG not properly converted to PDFBug
IMAGINGJAVA-1133Exception on loading EPS imageBug
IMAGINGJAVA-1208Incorrect converting EMF to PNGBug

Public API changes:

Added APIs:

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

Removed APIs:

No Change

Usage examples:

IMAGINGJAVA-1221 Optimize JPEG2000 memory usage if possible

 Image image = Image.load("test.dng");

try {

 ByteArrayOutputStream ms = new ByteArrayOutputStream();

 try {

  // rendering the image - the exception comes from here

  image.save(ms, new Jpeg2000Options());

  // sending the image by HTTP is emulated using the local storage

  RandomAccessFile fs = new RandomAccessFile("test.j2k", "w");

  try {

   fs.write(ms.toByteArray());

  } finally {

   fs.close();

  }

 } finally {

  ms.close();

 }

} finally {

 image.close();

}

IMAGINGJAVA-1222 Fix CMX image disposal error when loading from stream

 public void testImageDisposing() throws IOException {

 FileInputStream fs = new FileInputStream("test.cmx");

 try {

  ByteArrayInputStream input = copyStream(fs);

  try {

   Image image = Image.load(input);

   try {

    ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    try {

     BmpOptions options = new BmpOptions();

     CmxRasterizationOptions vectorRasterizationOptions = new CmxRasterizationOptions();

     options.setVectorRasterizationOptions(vectorRasterizationOptions);

     vectorRasterizationOptions.setPositioning(PositioningTypes.DefinedByDocument);

     vectorRasterizationOptions.setSmoothingMode(SmoothingMode.AntiAlias);

     vectorRasterizationOptions.setPageWidth(image.getWidth());

     vectorRasterizationOptions.setPageHeight(image.getHeight());

     image.save(outStream, options);

    } finally {

     outStream.close();

    }

   } finally {

    image.close();

   }

  } finally {

   input.close();

  }

 } finally {

  fs.close();

 }

}

private ByteArrayInputStream copyStream(FileInputStream fs) throws IOException {

 ByteArrayOutputStream dstStream = new ByteArrayOutputStream();

 byte[] buf = new byte[4096];

 while (true) {

  int bytesRead = fs.read(buf, 0, buf.length);

  if (bytesRead <= 0) {

   break;

  }

  dstStream.write(buf, 0, bytesRead);

 }

 return new ByteArrayInputStream(dstStream.toByteArray());

}

IMAGINGJAVA-1223 Fix CMX FileFormat: it’s set to Undefined instead of CMX

 final Image image = Image.load("test.cmx");

try {

 if (image.getFileFormat() != FileFormat.Cmx) {

  throw new AssertionError("Wrong format");

 }

} finally {

 image.close();

}

IMAGINGJAVA-1161 Incorrect converting EMF to PNG

 String path = "D:\\Temp\\";

Image image = Image.load(path + "example.emf");

try {

 PngOptions pngOptions = new PngOptions();

 EmfRasterizationOptions vectorRasterizationOptions = new EmfRasterizationOptions();

 pngOptions.setVectorRasterizationOptions(vectorRasterizationOptions);

 vectorRasterizationOptions.setPageWidth(image.getWidth());

 vectorRasterizationOptions.setPageHeight(image.getHeight());

 image.save(path + "example.png", pngOptions);

} finally {

 image.close();

}

IMAGINGJAVA-1114 DNG to JPEG conversion fails

 Image dngImage = Image.load("1.original.dng");

try {

 dngImage.save("1.original.dng.jpg", new JpegOptions());

} finally {

 dngImage.close();

}

IMAGINGJAVA-1210 CopyFrame lost XMP metadata

 String inputPath = "tiffFile.tif";

TiffImage tiffImage = (TiffImage) Image.load(imputPath);

try {

 XmpHeaderPi xmpHeader = new XmpHeaderPi();

 XmpTrailerPi xmpTrailer = new XmpTrailerPi(true);

 XmpMeta meta = new XmpMeta();

 meta.addAttribute("Test", "12345");

 XmpPacketWrapper packetWrapper = new XmpPacketWrapper(xmpHeader, xmpTrailer, meta);

 packetWrapper.addPackage(new PdfPackage());

 packetWrapper.addPackage(new XmpBasicPackage());

 TiffFrame frame = tiffImage.getFrames()[0];

 frame.setXmpData(packetWrapper);

 // Assertions XMP metadata in copied frame

 TiffFrame copiedFrame = TiffFrame.copyFrame(frame);

 try {

  if (copiedFrame.getXmpData() != null) {

   System.out.println("Xmp data in copied frame is not null");

  } else {

   throw new RuntimeException("Xmp data in copied frame is null");

  }

 } finally {

  copiedFrame.close();

 }

} finally {

 tiffImage.close();

}

IMAGINGJAVA-1137 Exception on converting EMF to PNG

 String path = "D:\\Temp\\";

Image image = Image.load(path + "example.emf");

try {

 PngOptions pngOptions = new PngOptions();

 EmfRasterizationOptions vectorRasterizationOptions = new EmfRasterizationOptions();

 pngOptions.setVectorRasterizationOptions(vectorRasterizationOptions);

 vectorRasterizationOptions.setPageWidth(image.getWidth());

 vectorRasterizationOptions.setPageHeight(image.getHeight());

 image.save(path + "example.png", pngOptions);

} finally {

 image.close();

}

IMAGINGJAVA-1076 Color radiance is lost for generated SVG in IE

 Image dngImage = Image.load("1.original.dng");

EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();

final Image image = Image.load("image34.emf");

try {

 emfRasterizationOptions.setPageSize(com.aspose.imaging.Size.to_SizeF(image.getSize()));

 SvgOptions tmp0 = new SvgOptions();

 tmp0.setVectorRasterizationOptions(emfRasterizationOptions);

 image.save("image34.emf.png", tmp0);

} finally {

 image.close();

}

IMAGINGJAVA-1149 SVG not properly converted to PDF

 SvgLoadOptions loadOptions = new SvgLoadOptions();

loadOptions.setDefaultWidth(1024);

loadOptions.setDefaultHeight(768);

Image image = Image.load("boxGetsBorder.svg", loadOptions);

try {

 SvgRasterizationOptions svgRasterization = new SvgRasterizationOptions();

 svgRasterization.setPageSize(Size.to_SizeF(image.getSize()));

 PdfOptions pdfSaveOptions = new PdfOptions();

 pdfSaveOptions.setVectorRasterizationOptions(svgRasterization);

 image.save("boxGetsBorder.svg.pdf ", pdfSaveOptions);

} finally {

 image.close();

}

IMAGINGJAVA-1133 Exception on loading EPS image

 Image image = Image.load("38233Y.EPS");

try {

 image.save("38233Y.EPS.png", new PngOptions());

} finally {

 image.close();

}

IMAGINGJAVA-1208 Incorrect converting EMF to PNG

 String path = "D:\\Temp\\";

Image image = Image.load(path + "example.emf");

try {

 PngOptions pngOptions = new PngOptions();

 EmfRasterizationOptions vectorRasterizationOptions = new EmfRasterizationOptions();

 pngOptions.setVectorRasterizationOptions(vectorRasterizationOptions);

 vectorRasterizationOptions.setPageWidth(image.getWidth());

 vectorRasterizationOptions.setPageHeight(image.getHeight());

 image.save(path + "example.png", pngOptions);

} finally {

 image.close();

}