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

Free Support Forum - aspose.com

Chart to Image artefacts

Hello. Can you please help me.

I need to receive an image of my chart, scaled in 70%. When i saved my chart to image, i have received an image with some noise. How i can fix it?

public void chartTest() throws Exception {
Workbook workbook = new Workbook(“D://chart.xlsx”);
Chart shape = workbook.getWorksheets().get(0).getCharts().get(0);
// Width
int w = (int) (shape.getChartObject().getWidth() * 0.7);
// Height
int h = (int) (shape.getChartObject().getHeight() * 0.7);

File f = new File(“D://out.png”);
try (FileOutputStream out = new FileOutputStream(f)) {
ImageOrPrintOptions options = new ImageOrPrintOptions();

int hDPI = ((Double) Math.floor(h/shape.getChartObject().getHeightInch())).intValue();
int wDPI = ((Double) Math.floor(w/shape.getChartObject().getWidthInch())).intValue();


shape.toImage(out, options);

Hi Alexey,

Thanks for your posting and using Aspose.Cells.

I have tested this issue with the following sample code with the latest .NET and Java versions and found Java version output shows noise but .NET version output does not show noise. I have attached both the output images for a reference.

I tested these issues on the following versions

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-41125 - Chart image has a noise with when converted with lesser resolution


string filePath = @“F:\Shak-Data-RW\Downloads\chart.xlsx”;

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.Worksheets[0];

Chart chart = worksheet.Charts[0];

ImageOrPrintOptions options = new ImageOrPrintOptions();

options.ImageFormat = ImageFormat.Png;

options.HorizontalResolution = 67;

options.VerticalResolution = 67;

chart.ToImage(“output-net.png”, options);

String filePath = "F:\\Shak-Data-RW\\Downloads\\chart.xlsx";

Workbook workbook = new Workbook(filePath);

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

Chart chart = worksheet.getCharts().get(0);

ImageOrPrintOptions options = new ImageOrPrintOptions();


chart.toImage("output-java.png", options);


Please try our latest version/ fix: Aspose.Cells for Java v8.3.1.2

We have fixed your issue now.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-41125) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.