# tex4ht: create (dummy) eps images on the fly

I am using tex4ht to create a document in HTML and my images are PNG files. For tex4ht I need eps images although in the final HTML page I use original PNG files (see my other question here on tex.se).

So the idea is to use a dummy eps image of a certain width and height (the size should not matter, as the final image is replaced anyway).

The current situation is the following: for every PNG image, I need an EPS image with the same name, for htlatex (DVI mode) to find it. The EPS is never visible to the user, it is only used internally. So IMO it is not really necessary. I would like to avoid the extra steps to create the EPS file and the double disk space (I use a lot of images).

-
see my answer for your original question –  michal.h21 Feb 5 '12 at 18:50
@michal.h21 can you turn your comment into an answer? It is a short answer, but it is the one I'd accept (according to the rule that the one that I use is the one I accept, even if there are longer/more technical/better answers). It is so simple that it works for me perfectly. –  topskip Feb 5 '12 at 20:04

Something along these lines

\let\oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[2][]{%
\ifthenelse{\boolean{htlatex}}%
{\oldincludegraphics{dummyeps}}%
{\oldincludegraphics[#1]{#2}}%
}


If you want to be able to adjust the size of the eps graphics, you could redefine \includegraphics with two additional arguments that set the height and the width attributes of \oldincludegraphics with htlatex but are discarded when compiling with pdflatex.

-

From (@michal.h21) the question linked in the post:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\begin{document}

\section{something}
\includegraphics[width=5cm]{mill.png}
\end{document}


Doesn't use eps images.

-