The reStructuredText markup language
includes the image
directive,
as do documentation generators built on reStructuredText such as
Sphinx.
How the image is included in the output
depends on the output format.
For example, the rst2odt
program does not copy image directories or image paths,
it copies the actual images into the ODT file.
ODT files are just ZIP files with a particular structure,
so you can unzip the ODT file and see the images in Pictures/
.
By contrast, the rst2html
program does not store images directly in the HTML file
as this is not typical of HTML.
Instead, it generates
an img
tag
that points to the image.
For example, this markup:
.. image:: example.png
will produce this HTML:
<img alt="example.png" src="example.png" />
The path example.png
is an example of a path relative to the source file,
but there are other options for img tags.
If you want to embed the images directly into the HTML file as e.g.
data URLs,
you will need to do something else, such as:
Manually convert the image to Base64, use it to make an HTML img tag with the data URL, and include it in the reStructuredText using the
raw directive.
For example, this markup:
.. raw:: html
<img alt="red square" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAA1BMVEX/AAAZ4gk3AAAAFElEQVQ4 y2NgGAWjYBSMglFATwAABXgAASlxufwAAAAASUVORK5CYII=" />
will produce this HTML:
<img alt="red square" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAA1BMVEX/AAAZ4gk3AAAAFElEQVQ4 y2NgGAWjYBSMglFATwAABXgAASlxufwAAAAASUVORK5CYII=" />
which will produce this image:

Use a tool such as SingleFile,
inliner,
or webpage2html
to post-process the generated HTML.
Note there are limitations on data URLs, including
browser-dependent size restrictions.
Related: