# Configure tex4ht for linked images

I have a document that is to be compiled in PDF (using pdflatex) and XHTML (using tex4ht). For the XHTML version, I wish to have the images linking to their source in a new window (target="_blank").

Now, this is perfectly possible by some fiddling with \HCode, but I prefer not having to write this every time when I include a graphic in my TeX source.

Is there a \Configure command I can use in my tex4ht config file, so that an a-tag is wrapped around the resulting img-tag automatically?

Note: I noticed \Configure{IMG}, but I assume that's for generated images, + there is not clear "image source" variable I can use.

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code. – Corentin Oct 23 '12 at 10:07
Oh, sorry, I was wondering if that was possible or not. Thanks for the edits! – hbro Oct 23 '12 at 11:25
– michal.h21 Oct 23 '12 at 11:36
@michal.h21 You sir, are my hero! Maybe make an actual answer out of it that I can promote? – hbro Oct 23 '12 at 12:05

Based on tex4ht faq:

Create custom config file:

\Preamble{xhtml}
\Configure{graphics*}
{png}

compile with htlatex texfile customcfgfile`