Exporting PNG or TIFF charts with transparent background

I am using the VBA api to automatically export charts. Originally, I exported them as EMF files and by turning the chart background to ‘no fill’ I could get the backgrounds of the exported charts to be transparent. However, when I do the exact same export on the same charts but as PNGs instead, the charts come out with white backgrounds.

Does anyone know how I can get the charts to export as PNG files (or any web suitable image format), and keep their transparent background? As I am sure that this file format should be able to handle transparency.

Any help would be greatly appreciated. And thanks to the developer for this great piece of software!

Andrew

Hi Andrew,

the Toolbox currently cannot do this, unfortunately. Internally, it ‘asks’ Windows to draw the chart to be exported in memory, and then the FreeImage library is used to create a graphics file from this in-memory representation. Thus, the Toolbox currently has no means to interfere with the drawing of individual elements such as the chart background.

I am working on a revamped chart export engine, but it will take a while before it’s ready. I know that lots of people have come to like the Toolbox’ chart export feature, and I use it myself for my scientific work.

One workaround for the time being is to use an image manipulation software such as http://gimp.org to make the white background transparent.

Another workaround is to use http://inkscape.org to manually delete the background rectangle, then export the image to PNG. (Coincidentally I posted an http://xltoolbox.sf.net/blog/2014/02/export-excel-charts-to-svg-files about how to get Excel charts into Inkscape just yesterday.)

I know both of these methods are cumbersome if you need to export many charts, or update your charts often.

Kind regards

Daniel

Oh well, just realized you are using the API. So it’s probably not feasible to manually work with the exported charts…

Thanks Daniel. I’ll give your workarounds a shot. Cheers

Hi, if you’re still listening to this, try the new alpha versions (2 and higher), which support transparency.

xltoolbox.sourceforge.net/blog/2 … he-license