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

Free Support Forum - aspose.com

Picture extracted from Excel not smooth


I am using Aspose Cells for Java I wanted to extract a picture representing a chart from Excel workbook to Jpeg file. When I use toImage() function with image format set to Jpeg I get an image with sharp edges, but when I choose Emf as output file format I get the image with smoothed edges as I see it in Excel.

Is there a way to achieve smoothed edges effect in Jpeg image as well?

Please find enclosed the code I use to extract the picture, Excel workbook and output images archived in zip file.

Krzysztof Pawlowski

Hi Krzysztof,

Thank you for contacting Aspose support.

You may try by setting the Quality of the resultant Jpeg image to some lower value such as 60 or 70 by using the ImageOrPrintOptions.setQuality method. I hope this fulfills your requirement.

Hi Babar,

Many thanks for quick response.

I tried to lower the value for the quality parameter, but it is not something we want to achieve. The line is slightly better, but then the text gets distorted. The ideal solution would be jpeg image looking the same as emf image.

Do you happen to know other solution to that problem?


Hi Krzysztof,

Thanks for your posting and using Aspose.Cells.

Please try the following code and it should fix the jpeg image quality issue. I have attached the output jpg image for your reference.


String filePath = “F:\Shak-Data-RW\Downloads\Test.xlsx”;

//Load the source workbook

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.getWorksheets().get(0);

Picture pic = worksheet.getPictures().get(0);

ImageOrPrintOptions options = new ImageOrPrintOptions();

options.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

options.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

pic.toImage(filePath + “.out.jpg”, options);

Hi Shakeel,

Many thanks for your solution - the line on the chart looks definitely better.

The other concern out stakeholders have are fonts on the extracted chart. The picture in the Excel file is a vector image in emf format. If you compare original picture from Excel - screenshot attached as original.PNG - and extracted from excel to .emf (but .jpg as well) in exported.PNG screenshot you can see the zeros in the original file are slimmer and more round.

Is there any way to change the settings of saving the picture from excel worksheet in a way we do not see the change in the fonts?

Kind regards,

Hi Krzysztof,

Thanks for your feedback and using Aspose.Cells.

JPG or PNG images are raster graphics while EMF is a vector graphics. Therefore JPG/PNG gets distorted on zooming while EMF does not get distorted on zooming. If you want that your output image should not be distorted then you should save your output image in EMF format.

The quality of JPEG/PNG image cannot be improved further as they are already enhanced via setRenderingHint() method.

Thanks for quick reply.

Even if I am saving in EMF format I can see slight changes in text appearance. If you look at EMF file and Excel file in the zip archive I attached with the first post in this thread you’ll notice that 0s in Excel file are slimmer than those in EMF file (without zooming). I also tried the newest version of Aspose Cells for Java (8.0.0) and I can see that text after saving the image to EMF file (or JPG) is different to both versions of pictures mentioned above, in particular letters ‘a’ and ‘r’ are connected in word ‘dollars’. Do you have any idea what is the reason of such a behaviour?


Hi Krzysztof,

Thanks for your posting and using Aspose.Cells.

We have zoomed your result.emf quite a lot to a maximum and it did not get distorted in any way. So emf is working fine. I have attached the sample screenshots for your reference.

Many thanks Shakeel.

You’re right - EMF file looks the same as it looked in Excel. Apologies, I was using wrong application to open EMF file.

Sorry for inconvenience,

Hi Krzysztof,

Thanks for your feedback and using Aspose.Cells.

It is good to know that this issue is sorted out now. Some applications like Internet Explorer converts the EMF file into BMP/JPEG before displaying so when the image is zoomed, it gets distorted.

Let us know if you face any other issue, we will be glad to look into it and help you further.