# CairoMakie and Litterate: save images as separate files

**URL:** <https://discourse.julialang.org/t/cairomakie-and-litterate-save-images-as-separate-files/134180>\
**Category:** General Usage\
**Tags:** makie, litterate\
**Created:** [November 28, 2025, 8:38am UTC](https://discourse.julialang.org/t/cairomakie-and-litterate-save-images-as-separate-files/134180 "2025-11-28T08:38:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [November 28, 2025, 8:38am UTC](https://discourse.julialang.org/t/cairomakie-and-litterate-save-images-as-separate-files/134180/1 "2025-11-28T08:38:16Z")

</div>

In CairoMakie.jl v0.15.7 and Litterate.jl v2.21.0, images are now embedded (see below) per default, while previously they were stored as separate png files. Does somebody know to use separate files as before?

Litterate source file `test.jl`:

```julia-auto
using CairoMakie
function myplot()
    fig = Figure()
    ax = Axis(fig[1, 1])
    hm = heatmap!(ax,randn(1000,1000))
    return fig
end

myplot()

```

Converted with:

```julia-auto
using Literate
Literate.markdown("test.jl",".", execute = true, documenter = true)

```

The generated markdown file contains the base64 encoded image while I prefer the use of a separate png files:

```julia-auto
<img width=600 height=450 style='object-fit: contain; height: auto;' src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAABLAAAAOECAYAAACxbcj6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgO....

```

Embedding the base64 encoded data creates very large files that Documenter.jl complains about. This code is run in CI to generate the documentation stored in a git repo. I am also worried about the total repo size as I think that using png files directly is a more efficient way to store the figures.

---

<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:** [November 28, 2025, 9:02am UTC](https://discourse.julialang.org/t/cairomakie-and-litterate-save-images-as-separate-files/134180/2 "2025-11-28T09:02:20Z")

</div>

The embedded html version exists because it makes pngs appear at the correct logical size, independent of pixel density. You can disable the text/html MIME type for which this behavior is implemented and instead force basic png using `CairoMakie.enable_only_mime!("png")`

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [December 1, 2025, 11:44am UTC](https://discourse.julialang.org/t/cairomakie-and-litterate-save-images-as-separate-files/134180/3 "2025-12-01T11:44:32Z")

</div>

Thanks a lot @jules  
(my notebooks are now 50% smaller 🙂 )
