Re: Copying image files with HTML output

Gavin Smith <[email protected]> Sat, 1 Aug 2026 19:42:40 +0100
Newsgroups gmane.comp.tex.texinfo.general
Message-ID <am4-IMdI6A6v73LN@orangestar>
On Fri, Jul 31, 2026 at 10:03:35PM +0000, Dimitris Papavasiliou wrote:
> When building HTML ouput, texi2any expects to find image files in the
> same directory as the .texi input files, but for the HTML to be
> rendered correctly, they need to be in the same directory as the
> output files. These are generally different directories.
> 
> According to the manual, "Image files referred to from the Texinfo
> manual, if found, are copied to subdirectories of the container
> directory", but this is only for EPUB output.  Shouldn't this happen
> for HTML output as well?  If not, how is this normally handled?
> 
> My image files are generated, so I don't have an explicit list of
> files, but I can still copy them easily enough because they're the
> only jpg files in the source directory.  It could be more complicated
> in other situations I imagine and in the end texi2any is best placed
> to take care of this, as it knows which the files in question are.

I do not actually know how this is usually done, but I expect it would be
done with Makefile rules.

For example, I found that the gawk manual contained images:

https://www.gnu.org/software/gawk/manual/html_node/Extension-Mechanism-Outline.html

In the gawk source code (I'm looking at commit c247d719316c2cc06, dated
2026-05-29), the manual is under the doc/ subdirectory.

In doc/Makefile.am, the image files are listed in variables:

png_images = gawk_api-figure1.png gawk_api-figure2.png gawk_api-figure3.png \
	gawk_array-elements.png gawk_general-program.png gawk_process-flow.png
html_images = $(png_images) gawk_statist.jpg

And then there is a rule to copy these images to the installation directory:

# Install/unistall graphic image files in the html doc dir

install-html-local:
	@$(NORMAL_INSTALL)
	@list='$(html_images)'; test -n "$(htmldir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
	fi; \
	for p in $$list; do \
		$(INSTALL_DATA) $$p "$(DESTDIR)$(htmldir)" || exit $$?; \
	done;

uninstall-local:
	@$(NORMAL_UNINSTALL)
	@list='$(html_images)'; test -n "$(htmldir)" || list=; \
	for p in $$list; do \
	  echo " rm -rf '$(DESTDIR)$(htmldir)/$$p'"; \
	  rm -rf "$(DESTDIR)$(htmldir)/$$p"; \
	done

It's possible that you aren't interested in "installing" the images (for
an HTML manual, it would be usual to upload to a webserver rather than
accessing it on a local machine), but you could use similar rules to
copy images to the output directory.

I do not know if this has been considered before or why images aren't
copied automatically for HTML output.  (Maybe Patrice will know.)
The only idea I have is that images could take up a lot of disk storage space.