# How to export transparent raster plots?

Is there an easy way to get transparent plots that work with Save Graphic As using a compatible file format such as GIF or PNG? I tried Background->Opacity[0,White] and Background->None, yet the exported PNGs appear to still have a white background.

-
If questions could receive bounties, I would give you 500 right now. I couldn't find the answer to this for my life! Isn't it ironic I posted it myself 4 years ago? – Szabolcs Feb 23 at 9:44

Instead of using Save Image As... you can use the Export command, like this:

Export["transparent.png", Graphics[Circle[]], Background -> None]


For this to work it is important that Background -> None is also set inside Graphics. This is the default though so unless you changed it, it should be fine.

Similarly, to convert to an image with alpha channels, use

Rasterize[Graphics[Circle[]], "Image", Background -> None]


The output of this can be saved even using Save Image As..., but this effort needed is the same because of the Rasterize function.

-
Does the Save Graphic As command have a bug? – Emre May 9 '12 at 8:42
@Emre No, it simply doesn't provide a way to change as many options as Export does. The background is white by default when exporting. You need to change it to transparent, and this is possible with Export but not with the simpler Save Graphic/Image As.... People typically need the white background (imagine someone putting a figure with black lines on a black-background webpage), so this is the default. – Szabolcs May 9 '12 at 8:43