# How to include bitmap images in CairoMakie?

**URL:** <https://discourse.julialang.org/t/how-to-include-bitmap-images-in-cairomakie/94988>\
**Category:** Visualization\
**Tags:** plotting, graphics, makie, cairo, glmakie\
**Created:** [February 22, 2023, 12:08am UTC](https://discourse.julialang.org/t/how-to-include-bitmap-images-in-cairomakie/94988 "2023-02-22T00:08:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhchang96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yhchang96/32/36499_2.png) [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Post date:** [February 22, 2023, 12:08am UTC](https://discourse.julialang.org/t/how-to-include-bitmap-images-in-cairomakie/94988/1 "2023-02-22T00:08:29Z")

</div>

I have a big figure panel which consists many smaller 2D/3D figures. As I would like vector graphics for the 2D parts (and if possible the axes labels, titles, etc for the 3D parts) I use `CairoMakie`. However, I find that the 3D surface plots generated by `GLMakie` looks better than `CairoMakie` (and in some cases `CairoMakie` gives the ‘wrong’ color, for example in the 2nd example '[here](https://beautiful.makie.org/dev/examples/generated/2d/surfaces/surface_filled_sides/#sides-colour-gradient-bottom-to-top)) for my data.

So my question is, is it possible to have a 3D surface plot generated by `GLMakie`, and then incorporated (as a bitmap) into a vector graphics generated by `CairoMakie` saved as pdf? Since they are different backends, so I guess it is impossible to do so in one single step. If that’s indeed the case, are there ways to accomplish this sequentially? (e.g. first export the 3D surface plot as .jpg or .png using `GLMakie`, then import the bitmap, and generate the final figure as .pdf using `CairoMakie`).

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [February 22, 2023, 1:54am UTC](https://discourse.julialang.org/t/how-to-include-bitmap-images-in-cairomakie/94988/2 "2023-02-22T01:54:52Z")

</div>

I had a [PR](https://github.com/MakieOrg/Makie.jl/pull/2061) up which did exactly this, which I am looking to revive. You can indeed do this sequentially, but it’s nontrivial. If you’re OK with using a dev branch, I can clean it up today ish and you could probably use it then.

The interface would be similar to `rasterize=true` in CairoMakie, but would also include the ability to rasterize a whole Scene (so that you get the benefits of e.g. depth buffering).
