Browse our Products

Aspose.Imaging for Java 21.8 - Release notes

Competitive features:

KeySummaryCategory
IMAGINGJAVA-7887Incorrect number of cycles in exported GIF animationEnhancement
IMAGINGJAVA-7886Cannot set number of cycles in exported GIF animationEnhancement
IMAGINGJAVA-7884Incorrect export from CDR to PSDEnhancement
IMAGINGJAVA-7877Particular CDR file cannot be opened/rasterizedEnhancement
IMAGINGJAVA-7875Image saving failed when converting WMFEnhancement
IMAGINGJAVA-7874Text in saved EMF is garbledEnhancement
IMAGINGJAVA-7872Measure String for Graphics.DrawString methodEnhancement
IMAGINGJAVA-7871Backport of Aspose.PSD to Aspose.ImagingEnhancement
IMAGINGJAVA-7852Memory leak when saving EPS to PSDEnhancement
IMAGINGJAVA-7851Improve original (prior to Version 2.0) TGA file format supportEnhancement
IMAGINGJAVA-7850Exception on exporting DCM to APNGEnhancement
IMAGINGJAVA-7814Exception on loading imageEnhancement
IMAGINGJAVA-7772Convert EMF to PNG will generate too many font files under TempFontsGraphicsEnhancement
IMAGINGJAVA-628Calling resize method of SvgImage class is throwing exceptionEnhancement

Public API changes:

Added APIs:

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

Removed APIs:

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

Usage Examples:

IMAGINGJAVA-7887 Incorrect number of cycles in exported GIF animation

String path = "ezgif.com-gif-maker(1)___.gif";
try (GifImage image = (GifImage)Image.load(path))
{
    image.save("output.gif", new GifOptions() {{ setLoopsCount(4); }});
}

IMAGINGJAVA-7886 Cannot set number of cycles in exported GIF animation

String path = "ezgif.com-gif-maker(1)___.gif";
try (GifImage image = (GifImage)Image.load(path))
{
      System.out.println(image.getLoopsCount() == 7 ? "OK" : "False");
      image.setFrameTime(2000);
      ((GifFrameBlock)image.getPages()[0]).setFrameTime(200);
      image.save("output.gif", new GifOptions() {{ setLoopsCount(4); }});
}

IMAGINGJAVA-7884 Incorrect export from CDR to PSD

String baseFolder = "D:\\";
String fileName = "yo calender.CDR";
String inputFilePath = baseFolder + fileName;
String outputFilePath = inputFilePath + ".psd";
try (CdrImage image = (CdrImage)Image.load(inputFilePath))
{
    image.save(outputFilePath, new PsdOptions()
    {{
        setVectorRasterizationOptions(new CdrRasterizationOptions()
        {{
              setPositioning(PositioningTypes.Relative);
        }});
    }});
}

IMAGINGJAVA-7877 Particular CDR file cannot be opened/rasterized

String baseFolder = "D:\\";
String fileName = "LETTER HEAD.cdr";
String inputFilePath = baseFolder + fileName;
String outputFilePath = inputFilePath + ".png";
try (CdrImage image = (CdrImage)Image.load(inputFilePath))
{
    image.save(outputFilePath, new PngOptions()
    {{
        setVectorRasterizationOptions(new CdrRasterizationOptions()
        {{
             setPositioning(PositioningTypes.DefinedByDocument);
        }});
    }});
}

IMAGINGJAVA-7875 Image saving failed when converting WMF

try (Image image = Image.load("1480 HANGER FORM AND DIE SCHEMATIC.WMF"))
{
	PngOptions saveOptions = new PngOptions();
	image.save("output.png", saveOptions);
}

try (Image image = Image.load("1480 HANGER FORM AND DIE SCHEMATIC.WMF"))
{
	SvgOptions saveOptions = new SvgOptions();
	image.save("output.svg", saveOptions);
}

IMAGINGJAVA-7874 Text in saved EMF is garbled

String baseFolder = "D:\\";
String inputFileName = baseFolder + "original.emf";
String outputFileName = baseFolder + "saved.emf";
try (Image image = Image.load(inputFileName))
{
     image.save(outputFileName);
}

IMAGINGJAVA-7872 Measure String for Graphics.DrawString method

try (Image backgoundImage = Image.load("image1.png"))
{
    Graphics gr = new Graphics(backgoundImage);
    com.aspose.imaging.StringFormat format = new com.aspose.imaging.StringFormat();
    com.aspose.imaging.SizeF size = gr.measureString("Test", new com.aspose.imaging.Font("Arial",10), com.aspose.imaging.SizeF.getEmpty(), format);
    float expectedWidth = 31.15668f;
    Assert.that(Math.abs(size.getWidth() - expectedWidth) <= 1.0f);
    float expectedHeight = 16.5625f;
    Assert.that(Math.abs(size.getHeight() - expectedHeight) <= 1.0f);
}

IMAGINGJAVA-7871 Backport of Aspose.PSD to Aspose.Imaging

// This code should successfully export a PSD image
try (JpegImage image = (JpegImage)Image.load("3.jpg"))
{
	image.save("output.psd", new PsdOptions());
}

// This code should throw an ImageLoadException
try (Image image = Image.load("output.psd"))
{

}

IMAGINGJAVA-7852 Memory leak when saving EPS to PSD

String inputFilePath = "file_2.eps";
String outputFilePath = inputFilePath + ".psd";
while (true)
{
    try (Image image = Image.load(inputFilePath))
    {
         try (PsdOptions options = new PsdOptions())
         {
               try (EpsRasterizationOptions rasterizationOptions = new EpsRasterizationOptions())
               {
                   rasterizationOptions.setPageWidth(6633);// image.Size.Width;
                   rasterizationOptions.setPageHeight(6633);// image.Size.Height;
                   options.setVectorRasterizationOptions(rasterizationOptions);
                   image.save(outputFilePath, options);
               }
         }
   }

   Thread.sleep(300);
}

IMAGINGJAVA-7851 Improve original (prior to Version 2.0) TGA file format support

try (Image image = Image.load("envanter.tga"))
{
    image.save("output.png", new PngOptions());
}

IMAGINGJAVA-7850 Exception on exporting DCM to APNG

String inputFilePath = "1.3.12.2.1107.5.3.33.1214.11.202105032002480765.dcm";
String outputFilePath = inputFilePath + ".png";

try (Image image = Image.load(inputFilePath))
{
	image.save(outputFilePath, new ApngOptions() {{ setDefaultFrameTime(300); }});
}

IMAGINGJAVA-7814 Exception on loading image

try (Image image = Image.load("sankey1a.png"))
{
    image.save("sankey1a.png.jpg", new JpegOptions());
}

IMAGINGJAVA-7772 Convert EMF to PNG will generate too many font files under TempFontsGraphics

File f = new File(System.getProperty("java.io.tmpdir") + "/TempFontsGraphics");
if (!f.exists())
	f.mkdirs();

int wasFiles = 0;

for (int i = 0; i < 20; i++)
{
	PngOptions pngOpts = new PngOptions();
	try (Image image = Image.load("image.emf"))
	{
		image.save("image.emf.png", new PngOptions());
	}

	if (i == 0)
	{
		wasFiles = f.list().length;
	}
}

int nowFiles = f.list().length;
Assert.assertEquals(wasFiles, nowFiles, "Incorrect work of the font subsystem!");

IMAGINGJAVA-628 Calling resize method of SvgImage class is throwing exception

try (Image svg = Image.load("gump-bench.svg"))
{
	svg.resize(svg.getWidth() / 2, svg.getHeight() / 2);
	svg.save("gump-bench-resized.svg");
}