|
From: Guenter M. <mi...@us...> - 2026-01-27 13:11:28
|
On 2026-01-26, Matěj Cepl wrote: > When running suggested command `docutils --parser=myst --writer=odt > becoming_adult.md becoming_adult.odt` I get this error: > $ docutils --verbose --traceback --parser=myst --writer=odt bec > oming_adult.md becoming_adult.odt > Traceback (most recent call last): ... > PIL.UnidentifiedImageError: cannot identify image file 'parent_and_child.svg' > If it is a known limitation of the ODT writer, is there a ticket for it? Known limitations to image formats are (or are supposed to be) documented in https://docutils.sourceforge.io/docs/ref/rst/directives.html#images The documentation lists SVG and PDF as supported, however: SVG and PDF vector graphics are supported by the ODT format but currently not by the ODT writer. This will be fixed in the documentation ASAP. Unresolved exceptions (aborting processing and asking for --traceback) are bugs. > I cannot find anything on https://sourceforge.net/p/docutils/bugs/ The ODT writer's "traceback" on unsupported image formats is not yet reported. > The minimal reproducer can be: > ```markdown > ---- > date: 2026-01-25T11:00:00 > category: faith > tags: [innerHealing, sermon, PCF] > ---- > # Becoming adult > ```{image} parent_and_child.png > :alt: A schematic image of large adult facing a child > :width: 50% > :align: center > ``` > ``` Uh, does it really also fail with a PNG image? (It works here.) > Any thoughts? The HTML writers use the PIL library to get the image size from the graphics file for the :scale: option -- as a result, the :scale: option does not work with SVG images (PIL only works with raster image formats). I checked, whether a similar restriction applies to adjusting the size with :height: or :width: in the ODT writer. Unfortunately, also the truely minimal example:: .. image:: we-rgb.svg failed. Unfortunately, I don't know how to insert graphics into OTD, so there may be no quick fix. Possible workarounds include * using exporting to LaTeX and compile to PDF * using a PNG image * post-process the document after the export in the LibreOffice writer. Günter |