Converting chart with an image inside it to image distorts the image

Hello,
When trying to convert a chart which has an image inside of it, to an image using .toImage method, the image inside of the chart gets distorted and doesn’t match the original chart.

Here’s a simple code snippet I’m using to convert the excel chart to a png image:

Workbook workbook = new Workbook("Book1.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
Chart chart = worksheet.getCharts().get(0);
chart.toImage("chart.png");

Generated image doesn’t match original chart from excel.
I’ve attached the excel file with the chart and the generated image.
ChartToImage.zip (69.5 KB)

@dfinsolutions
chart.png (21.7 KB)

Which version are you using ? Please try the latest version 25.1.
And we added an issue CELLSJAVA-46242 in our internal tracing system for this issue. We will check it soon.

Hi @dfinsolutions
We investigated this issue, and the output results are as follows, and no obvious distortion was found. (I have tested it under Aspose.Cells for .net and Java.)
Since you provided Java code, the following image is the output I got using Aspose.Cells for Java 25.1.
250121.png (42.7 KB)

Would you please confirm the following information:
1, The version of Aspose.Cells you are using (.net, net6, or Java, JDK version) and the runtime environment(windows or linux, skiasharp or system.drawing.common).
2, Have you made additional settings for the environment’s DPI.
3, Please try the following code and let us know your feedback, thank you.

	String path = "";
	Workbook book = new Workbook(path + "Book1.xlsx");
    Chart chart = book.getWorksheets().get(0).getCharts().get(0);
    ImageOrPrintOptions options = new ImageOrPrintOptions();
    options.setImageType(ImageType.PNG);
    options.setVerticalResolution(96);
    options.setHorizontalResolution(96);
    chart.toImage(path + "out_java.png", options);

Using Aspose.Cells 25.1 for Java and your given code snipped I still get distorted results.
I’ve attached an image of how the original chart looks inside of excel and how exported image looks.
image.png (96.3 KB)

@dfinsolutions
Did you view the sample file on Mac OS? We used Office 365 on Windows to view and found that the output result was the same as Excel.

Hi @dfinsolutions
Please take a look at the situation presented in the picture I sent, in Excel.
The green and red horizontal bars are pushed down a distance (in my excel). This is the reason why it goes out of the circle.
It seems that different versions of Excel display this situation (shape placed inside the chart) differently.
Can you confirm your Excel version and the environment you are using? Thank you.

I am using Microsoft Excel Version 16.93 (25011212) on MacOs 14.7.2 (23H311).

@dfinsolutions,

Thanks for the providing details on Microsoft Excel version. We will be looking into your issue soon.

Hi @dfinsolutions
For this issue, we conducted more research. We noticed that the “workbook.DefaultStyle.Font” setting in the Excel file you provided is set to “Aptos Narrow”.

Please confirm that the “Aptos Narrow” font is correctly installed in your MAC environment. If the font is missing, the column width may change resulting in the shape being stretched horizontally.

Attached is a file for your reference after we changed the default font to “Arial”. You can also use it for observation and testing.

Please let us your feedback, thank you.
Book1_Arial.zip (41.6 KB)