We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Slowness in Image conversion (EMF to SVG)

Hello there,

We tried to use 18.6(aspose-imaging-18.6-jdk16.jar) imaging jar for converting EMF images to SVG files.

We could observe slowness in the conversion process. It is taking ~3 mins for converting the image.

Attached is the image we are trying to convert. Below is the sample code snippet we tried.

Code :

try {
// Create an instance of EmfRasterizationOptions class and set
// different options
System.out.println("Conversion start : "+System.currentTimeMillis());
final EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.setBackgroundColor(Color.getWhite());
emfRasterizationOptions.setPageWidth(image.getWidth());
emfRasterizationOptions.setPageHeight(image.getHeight());

			System.out.println("Conversion got the image dimenions   : "+System.currentTimeMillis());

			// call the save method and pass instance of SvgOptions class to
			// convert it to SVG format.
			image.save(dataDir + "image3.svg", new SvgOptions() {
				{
					setVectorRasterizationOptions(emfRasterizationOptions);
				}
			});
			
		} finally {
			image.dispose();
			System.out.println("Conversion end   : "+System.currentTimeMillis());
		}

Out put :
Conversion start : 1530043051622

Conversion end : 1530043230207image3.zip (2.6 KB)

@gmusturi,

I have observed the information shared by you and like to share that I have not been able to use the sample code on my end owing to custom class implementation. I request you to please share a working sample code with us that we may use on our end to verify the issue.

Hi @mudassir.fayyaz, Please find below code snippet.

           String dataDir = "C:\\media\\";
	
	System.out.println("Load start : "+System.currentTimeMillis());
	
	Image image = Image.load(dataDir + "image3.emf", new MetafileLoadOptions(true));
	
	System.out.println("Load end   : "+System.currentTimeMillis());
	try {
		// Create an instance of EmfRasterizationOptions class and set
		// different options
		System.out.println("Conversion start : "+System.currentTimeMillis());
		final EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
		emfRasterizationOptions.setBackgroundColor(Color.getWhite());
		emfRasterizationOptions.setPageWidth(image.getWidth());
		emfRasterizationOptions.setPageHeight(image.getHeight());
		
		System.out.println("Conversion got the image dimenions   : "+System.currentTimeMillis());

		// call the save method and pass instance of SvgOptions class to
		// convert it to SVG format.
		image.save(dataDir + "image3.svg", new SvgOptions() {
			{
				setVectorRasterizationOptions(emfRasterizationOptions);
			}
		});
			
		} finally {
			image.dispose();
			System.out.println("Conversion end   : "+System.currentTimeMillis());
		}

@gmusturi,

I have worked with the EMF file shared by you using Aspose.Imaging for Java 18.6 with Java 1.7_79 in Windows 7 environment. It worked without any issue or slow performance on my end. The following statistics have been achieved on my end.

Load start : 1530113602123
Load end : 1530113602272
Conversion start : 1530113602272
Conversion got the image dimenions : 1530113602274
Conversion end : 1530113604235
BUILD SUCCESSFUL (total time: 3 seconds)

image3.zip (3.9 KB)

@mudassir.fayyaz,

I am using evaluation version, does that make any difference ?

@gmusturi,

I don’t think evaluation version has any such limitation. You can avail the temporary license as well by following the guidelines shared over this web link.

Thanks @mudassir.fayyaz, I am able to use temporary license and convert the images. Thanks again!!