Chart.ToImage quality

I have created a chart with excel 2007 and am trying to export it with Chart.ToImage(). The output file quality is nowhere close to the detail of the chart in the spreadsheet, x-values don’t fit correctly, etc…Is this component supposed to accurately render the chart as it appears in the worksheet itself?

I am using version 4.6 of Aspose.Cells for .Net.

Hi,

Thank you for considering Aspose.

Please share your template file and code, so we can figure out the issue you are having.

Thank You & Best Regards,

VB.NET CODE:

Dim workbook As New Workbook()
workbook.Open(“c:\myTemplate.xlsx”)
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim chart As Chart = worksheet.Charts(0)
Dim bitmap As System.Drawing.Bitmap = chart.ToImage()
bitmap.Save(“c:\test.jpg”, ImageFormat.Jpeg)

Oh, and here is the resulting jpeg…

Hi,

Thank you for sharing the template file and sample code. We have found the issue you mentioned (in Excel 2007 file format) after an initial test. We will fix it and get back to you soon.

Thank You & Best Regards,

If I save the template as an Excel 2003 workbook and run the code again, I get something better but the text and lines are very jaggy…at least compared to how the chart shows up in real excel.

test.jpg is using Chart.ToImage(). fromExcel.PNG is how it looks in Excel.

EDIT: It looks like your rendering engine does not antialias the drawn lines in your line charts. It looks like you are just using System.Drawing.Graphics (?) which makes this ridiculously easy with Graphics.SmoothingMode…



Hi,

Thank you for sharing further information.We are looking into your issue and we will get back to you soon.

Thank you for your patience,

There are a couple more fairly serious problems:

1. The line colors are way off. In the spreadsheet I provided, the chart’s series have the colors:
Series 1: (51,131,151)
Series 2: (127,127,127)

Aspose renders this as:
Series 1: (51, 153,102)
Series 2: (128,128,128)

2. The rendered line markers are sized too small. I can fix this with a little code pretty easily (always up the marker size by 2 or so), but if you look at the image I have attached, which is how Excel exports its own chart (using VBA), you can see that they make the line markers much larger than you guys do. This may be due to the antialiasing that the VBA engine does to the lines…not sure.

Hi,

Thank for all your feedback, currently we are not supporting the Excel 2007 chart to Image conversion in Aspose.Cells. Our schedule is to start this feature’s development form the next month. We will try to support all of you mentioned issues and we will appreciate if you can provide us with the list of chart types which you are using, so we can provide you with your required features at the earliest.

Thank you for understanding,

Is your development for Excel 2007 on track for being released in the near future? We have a new requirement that we cannot even use compatibility mode for our new spreadsheets (which we HAVE to develop in Excel 2007).

Hi,

Thank you for considering Aspose.

We are working on this feature and we will release the Chart2Image feature for Excel 2007 file format soon.

Thank you for understanding,

Hi,

Thank you for considering Aspose.

Following is the complete schedule for this feature (Chart2Image for Excel 2007).

1: Development Started in Feb 2009.

2: Development Scheduled to complete on 30th April 2009.

3: After testing the release is scheduled on 30th May 2009.

Thank You & Best Regards,

Hello,

Has any progress been made in terms of the quality of the image itself that is being exported when using Chart.toImage? I have upgraded to Aspose.Cells version 4.7.1, but I haven't seen any increase in the quality of the charts from previous versions in terms of jagged lines.

I've attached my excel file and the resulting jpeg from export. As you can see, the line quality is drastically reduced from viewing the chart in Excel and the exported jpeg. I've tried using NSeries.Smooth = true and setting the jpeg quality to 100, but that doesn't have any effect.

Thanks,

Matt

Hi Matt,

Thank you for considering Aspose.

After an initial test we found your mentioned issue regarding image quality of generated Jpeg is not very good as compared to the excel chart. We will look into your issue and try to improve the image quality and get back to you soon.

Thank You & Best Regards,

Thank you very much for your responsiveness!

Hello,

Is there an estimated time of completion for improvement of the chart quality in the Excel export?

Thanks,

Matt

Hi Matt,

Thank you for considering Aspose.

We will update you soon regarding your issue.

Thank You & Best Regards,

Hi,

Well, currently, we do not support Chart2Image feature for MS.Excel 2007 formats. When you save chart to image directly, the resultant chart may not look like the same or very fine. So, you should save the excel file to 2003 xls format first. We have tested and converted your Aspose.xlsx" file to Aspose.xls" format is the MS 2003 format. Now take the images of the chart(s) from "Aspose.xls". I think the images are same as the original chart(s) in "Aspose.xls". Also, if you want to get an image that should not distorted when zooming it, you should create an Emf format image and not Jpeg.

I have also attached the latest version/fix of the component for you.

Thank you.

Hello Amjad,

We are already currently using the latest version of Aspose. Even if we save the file as an .xls file, the chart quality remains poor. This is regardless of the type of image file that it is saved as, whether it is .bmp, .jpg, or .emf. The lines are very pixellated compared to what the chart looks like when viewed in the Excel file. My guess is that the Excel rendering engine is antialiasing the lines while Aspose's rendering engine is not.

Matt

Hi Matt,

Did you try the attached version v4.7.1.10 which I attached in my previous post. We checked when you save as the Aspose.xlsx file to .xls format, the quality itself decreased, the lines are not really smooth. Therefore the output image would be the same. If you still find the issue, kindly post your input xls file, output emf image etc and we will check it soon.

Thank you.