How to avoid image embedding when nbconverting to MD

I am converting a set of Jupyter notebooks running a Julia kernel (1.10) that generate graphic images with the CairoMakie backend. Image files (.png) are created under the directory <notebookname>_files however the resulting .md file is not referencing them, instead, they are embedding the images with <img width=1280 height=720 style='object-fit: contain;' src="data:image/png;base64, iVBORw0KGgoAAA...<very long>...="/>
The command I use to convert is

% jupyter nbconvert --version                                                                                
% jupyter nbconvert --execute --to=markdown --output-dir=$output_dir  $notebook

Does anybody know how to avoid the embedding? I understand that the default is not embedding.

instead of just handing over the image data and let IJulia screw things up for you when executing a cell, try adding display("image/png", yourimage) at the end of your code.

This way the png will be embedded without the html you are seeing.
nbconvert will work as expected then.

1 Like

Thanks very much. It works now :slightly_smiling_face:. Indeed I was adding display(myimage) without the extra argument "image/png" and this made the difference.