Aspose.Imaging for Java logo

We are pleased to announce the release of Aspose.Imaging for Java 3.7.0. The major development in this release is support for Scalable Vector Graphics image. Support to apply font setting for metafiles (EMF) has also been incorporated in this release.

Support for SVG image

Aspose.Imaging for Java now supports the SVG image format (.svg). SVG stands for Scalable Vector Graphics. Aspose.Imaging for Java provides the SvgImage class to load SVG files and the same can be used to convert the SVG to raster formats.

Below provided sample code demonstrates how to convert a SVG file to PNG format.

Applying Font Settings For Metafiles

Using Aspose.Imaging for Java API, developers can apply font settings for metafiles (EMF). Following is the code demonstrates how to specify font folder settings for EMF image while converting it to PNG image.

// Create an instance of EmfRasterizationOptions class
com.aspose.imaging.imageoptions.EmfRasterizationOptions emfRasterizationOptions = 
        new com.aspose.imaging.imageoptions.EmfRasterizationOptions();

// Set different properties
emfRasterizationOptions.setBackgroundColor(com.aspose.imaging.Color.getWhiteSmoke());

// Create an instance of PngOptions class
PngOptions pngOptions = new PngOptions();

// Pass the instance of EmfRasterizationOptions class
pngOptions.setVectorRasterizationOptions(emfRasterizationOptions);

//Declare variables to store file path
String filePath = ".\\alphabet.emf";

// Create an instance of EmfImage class and Load an existing EMF image.
com.aspose.imaging.fileformats.emf.EmfImage image = 
        (com.aspose.imaging.fileformats.emf.EmfImage)com.aspose.imaging.fileformats.emf.EmfImage.load(filePath);
try
{
    // Cache the image data for speed
    image.cacheData();

    // Set width & height of resultant image
    pngOptions.getVectorRasterizationOptions().setPageWidth(300);
    pngOptions.getVectorRasterizationOptions().setPageHeight(350);

    // Reset font font settings
    com.aspose.imaging.FontSettings.reset();

    // Call the Image.save() method to create the resultant image with default settings.
    // image.save(filePath + "_default_fonts.png", pngOptions); // un-comment this line for testing

    //Declare variable to store font file path
    String fontPath = ".\\Fonts";

    // Create an instance of Array list and add all default font paths to it.
    List fonts = new ArrayList();
    java.util.Collections.addAll(fonts, com.aspose.imaging.FontSettings.getDefaultFontsFolders());

    // Now add the new font path
    fonts.add(fontPath);

    // Call the setFontsFolders method of the FontSettings class and supply the array of font paths
    com.aspose.imaging.FontSettings.setFontsFolders(fonts.toArray(new String[0]), true);

    // Save the results to disk with new fonts
    image.save(filePath + "_with_my_fonts.png", pngOptions);
}
finally
{
    image.dispose();
}

Enhancements

The following enhancements have been introduced in this release.

  • The process of loading WMF files has been improved.
  • Aspose.Imaging drawing engine has been improved.
  • The calculation process of Horizontal and Vertical resolution values has been improved.

Please refer to the release notes of Aspose.Imaging for Java 3.7.0 for a full view of improvements along with sample code snippets for newly added features. If you are planning to upgrade the API to the latest revision, we strongly suggest you check the Public API Changes section to know what has been changed in the public API since your current version.

Aspose.Imaging for Java Resources

The resources, you may need to accomplish your tasks:

As always we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.Imaging forum for a chat.