# Makie.jl Export with transparent background

**URL:** <https://discourse.julialang.org/t/makie-jl-export-with-transparent-background/93087>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [January 17, 2023, 11:52am UTC](https://discourse.julialang.org/t/makie-jl-export-with-transparent-background/93087 "2023-01-17T11:52:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Kleinbeck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin_kleinbeck/32/21278_2.png) [@Kevin\_Kleinbeck](https://discourse.julialang.org/u/Kevin_Kleinbeck)\
**Post date:** [January 17, 2023, 11:52am UTC](https://discourse.julialang.org/t/makie-jl-export-with-transparent-background/93087/1 "2023-01-17T11:52:23Z")

</div>

I have a high resolution dataset, about 1000x1000 points for which I want to export the surface plot, like in

```julia
fig = Figure(resolution = (1000, 1300), figure_padding = (0, 26, 2, 0))
axis = Axis3(fig[1, 1],
  azimuth = π/6, elevation = π/8, aspect = (1, 1, 1.3),
  backgroundcolor = :transparent
)
surface!(axis, xs, ys, data)

```

When I export the figure, like with `save("myfigure.png", fig)` however, Makie completely ignores the `:transparent` option. I tested both CairoMakie and GLMakie, and manually set the background via `RGBA` instead of the `:transparent` flag.

I assume the problem does not exist with vector graphics, but to the fine grained data set the resulting pdf is easily a few GB and thus unusable in further processing steps. Reducing the resolution is sadly not possible, I tested that, leading to unwanted artefacts or misrepresents the data. The resulting figure will be used in a cover, so a highly detailed image is wanted and necessary

Thus the questions:

1. Does Makie by default use a png encoding without transparency support? If so, how to tell Makie to change that?
2. Any other way to get the wanted result? I considered rasterising the resulting pdf, but every tool I know crashed to the immense size of the resulting figure.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [January 17, 2023, 1:52pm UTC](https://discourse.julialang.org/t/makie-jl-export-with-transparent-background/93087/2 "2023-01-17T13:52:19Z")

</div>

The `Figure` has a white background color by default, so set `:transparent` on that. Cairomakie can output transparent pngs, for GLMakie I once wrote a workaround (its buffer is only RGB for technical reasons) but I’d have to look it up first.

Also, with CairoMakie (and soon with GLMakie as well) you can use `px_per_unit = 2` or higher when saving to increase the resolution.
