Hi,
I am using chart.toImage(…) API to transform an excel chart to jpeg image.
I get the image but with black background though the source chart is with transparent background.
Attached a sample excel file with the incorrect image output.
Could you please verify this issue.
Aspose cells version being used: aspose-cells-8.3.2.jar.
Thanks,
Jaspreet
Hi,
In context of this issue I have another sample wherein the JPEG output is fine (white background & not black).
Check the attached excel document & JPEG output of Chart 1 in Rev Model sheet.
–Jaspreet
Hi Jaspreet,
In order to understand this scenario, please check the properties of the Chart Area of two aforementioned charts in Excel application. You will notice that the Fill property of the chart in Sample Excel.xlsx is set to No fill, that means; the Chart Area is transparent. Now, repeat the same for the chart in the spreadsheet Innovation_030414 (2).xlsx. You will see that the Fill property is set to Automatic, that actually means white. When you render both charts to Jpeg format, the transparent area will be rendered black because Jpeg format does not support transparency (alpha channel) whereas in second case the white area will be rendered white.
In order to deal with transparency, you have to choose the format that could support it, such as PNG from raster image formats. Please check the attachment for the PNG & Jpeg images generated for both charts.