Skip to content

fix: rendering of gif images in ipynb build #864

@m-reuter

Description

@m-reuter

Rendering a gif image (in my case an animated gif) does not work.
The ipynb cell has:
display(Image(filename=outpath_gif))
which works in ipynb, but sphinx degrades to a text/plain representation and does not show the gif.

I applied a monkeypatch via conf.py in here:

Deep-MI/WhipperSnapPy#59

  • Our tutorial notebook saves the rotation GIF to a temp file.
  • We add Sphinx conf.py monkeypatches to include image/gif in nbsphinx output selection and rendering.
  • We patch nbconvert’s output extraction so image/gif gets written as binary bytes to extracted files.

This works nicely and the animated gif shows in our tutorial:
https://deep-mi.org/WhipperSnapPy/dev/tutorials/whippersnappy_tutorial.html
(last cell)

It would be nice if this can be added to nbsphinx directly to avoid the monkey patch, which is not future proof.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions