EMF to WMF conversion and metered licensing support with Aspose.Imaging for Java 16.12

Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Imaging for Java logo We are pleased to announce the release of Aspose.Imaging for Java 16.12. The major development in this release is support for converting EMF metafile to WMF format. This release supports metered license mechanism. The new licensing mechanism will be used along with existing licensing method. Those customers who want to be billed based on the usage of the API features can use the metered licensing.

Converting EMF to WMF format

Using Aspose.Imaging for Java developers can convert EMF to WMF format. Below code demonstrates how EMF meta file can be converted to WMF metafile format.



// List of existing EMF images. 
        String path = "";
        String[] files = new String[] { "TestEmfRotatedText.emf", "TestEmfPlusFigures.emf", "TestEmfBezier.emf" };

        // Loop for each file name.
        for (String file : files)
        {
            // Input file name & path.
            String filePath = path + "\\" + file;
            
            // Load the EMF image as image and convert it to MetaImage object.
            com.aspose.imaging.fileformats.emf.MetaImage image = 
                    (com.aspose.imaging.fileformats.emf.MetaImage)com.aspose.imaging.Image.load(filePath, new com.aspose.imaging.imageloadoptions.MetafileLoadOptions(true));
            try
            {
                // Convert the EMF image to WMF image by creating and passing WMF image options class object.
                image.save(filePath + "_out.wmf", new com.aspose.imaging.imageoptions.WmfOptions());
            }
            finally
            {
                // clean the resources
                image.dispose();
            }
        }

Metered Licensing

Aspose.Imaging for Java provides the functionality to use metered licensing mechanism. We have introduced Metered class in the API to accomplish this job. The following sample code will demonstrate, how to calculate the consumed API requests.



// Create an instance of OCR Metered class
        com.aspose.imaging.Metered metered = new com.aspose.imaging.Metered();
        
        // Access the setMeteredKey property and pass public and private keys as parameters
        metered.setMeteredKey("", "");

        // Get consumed qantity value before accessing API
        System.out.println("Consumption quantity" + com.aspose.imaging.Metered.getConsumptionQuantity());
        
        // DO PROCESSING
        //com.aspose.imaging.Image img = com.aspose.imaging.Image.load("C:\\in.psd");
        //img.save("C:\\Temp\\out.psd");
        
        //Since upload data is running on another thread, so we need wait some time
        //java.lang.Thread.sleep(10000);
        
        // get metered data amount
        System.out.println("Consumption quantity" + com.aspose.imaging.Metered.getConsumptionQuantity());

Enhancements

Following enhancements have been introduced in this release.

  • Process of reading PSD layers has been improved.

  • Processing of JPEG format images has been improved.

  • Processing of Dicom format images has been improved.

  • Processing of Aspose.Imaging API in multi-threaded environment has been improved.

  • Process of rendering images in PSD file has been improved.

  • processing of saving TIFF frames has been improved.

Please refer to the release notes of Aspose.Imaging for Java 16.12 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 to 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.