# Reducing CairoMakie PDF file sizes with PNG integration

**URL:** https://discourse.julialang.org/t/reducing-cairomakie-pdf-file-sizes-with-png-integration/114948
**Category:** Visualization
**Tags:** cairomakie
**Created:** [May 30, 2024, 2:06am UTC](https://discourse.julialang.org/t/reducing-cairomakie-pdf-file-sizes-with-png-integration/114948 "2024-05-30T02:06:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nari/32/46452_2.png) [@nari](https://discourse.julialang.org/u/nari)
#### Post date: [May 30, 2024, 2:06am UTC](https://discourse.julialang.org/t/reducing-cairomakie-pdf-file-sizes-with-png-integration/114948/1 "2024-05-30T02:06:56Z")

</div>

The CairoMakie heatmap is very useful and I use it on a daily basis. However, the file size can be large when output to a pdf file (usually more than a few MB for my usage). By saving the layout, axes, annotations, etc. as a pdf and saving only the heatmap panels in png format and merging them later, the file size can be made small (e.g. under 1 MB). This is a band-aid for those who are not makie or pdf experts. If there is a better way, I would like to know.

---

<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: [May 30, 2024, 8:49am UTC](https://discourse.julialang.org/t/reducing-cairomakie-pdf-file-sizes-with-png-integration/114948/2 "2024-05-30T08:49:21Z")

</div>

there is a `rasterize` keyword that should rasterize a given plot object in CairoMakie

> **[CairoMakie | Makie](https://docs.makie.org/stable/explanations/backends/cairomakie#Selective-Rasterization)**
>
> Create impressive data visualizations with Makie, the plotting ecosystem for the Julia language. Build aesthetic plots with beautiful customizable themes, control every last detail of publication quality vector graphics, assemble complex layouts and...

---

<div class="post-metadata">

### Author: ![nari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nari/32/46452_2.png) [@nari](https://discourse.julialang.org/u/nari)
#### Post date: [May 30, 2024, 8:54am UTC](https://discourse.julialang.org/t/reducing-cairomakie-pdf-file-sizes-with-png-integration/114948/3 "2024-05-30T08:54:12Z")

</div>

This is exactly what I wanted. I was not aware that it was already available. I am glad I asked. Thank you very much.
