[l2h] png creation

Ross Moore ross at ics.mq.edu.au
Wed Apr 27 03:13:00 CEST 2005


Hello Martin,

On 27/04/2005, at 9:09 AM, Martin Matusiak wrote:

> I have a document with .eps figured and I'm using lyx as my editor. So 
> when I
> compile the documents into pdf, lyx exports to .tex, epstopdf converts
> all .eps images to .pdf and finally pdflatex generates the end product 
> pdf
> document.
>
> Now, when I want an html version, I need a .png image. I can run 
> epstopdf and
> then use convert (from imagemagick) to generate a .png file from the
> image.pdf.
>
> But with latex2html, the conversion from .eps to .png is done 
> implicitly and
> the output .png file is of very meagre quality (gray background among 
> other
> things)

To get a white background, simply add to the preamble of the LaTeX 
source:

  \usepackage{color}
  \pagecolor{white}

What other deficiencies do you observe concerning 'meagre quality'
of the .png images ?



> compared to the one I get using convert manually. So I'm wondering
> how I can influence the process of generating the .png image within
> latex2html?

Well, if you already have .png images which you like, then you don't
need to generate new ones. Instead use "conditional environments"
to select the existing graphics for HTML while allowing pdfLaTeX
to use the original vector graphic when you make PDF documents from
the same source.

Here's an example:

\usepackage{html}    %  needed in the preamble


%begin{latexonly}
  \includegraphics{figures/myimage}
%end{latexonly}
\begin{htmlonly}
  \htmladdimg[.... options ....]{../figures/myimage.png}
\end{htmlonly}

Look at the LaTeX2HTML documentation for the kind of things
that can go in the ... options ... .
In particular you can adjust the size of the image when displayed
in the browser, and its alignment on the web-page.

Note the need for the   ../  in the image's path.
This should give the full relative path from the location
of the resulting web-pages to where the images are stored.
This must be a valid (relative) URL that will work for
web-surfers who you want to be able to access your pages.
Only *you* can know what that path actually is.



Another option is to explore the  \htmlimage  command, which is
used to pass options to the image-generation process in LaTeX2HTML.
This is fully documented in the LaTeX2HTML manual.
(Again you need to have  \usepackage{html}  in the preamble,
if you want to use the same LaTeX source for purposes other than
making HTML pages. Indeed, you should *always* load this package
whenever using LaTeX2HTML, since it adds enormous functionality
to you documents, in terms of access to HTML features.)

Among the possibilities that are handled by \htmlimage is the
ability to affect the image resolution (quality ?) and
color-depth. Also, you can use it to request that a "thumbnail"
is inserted in the HTML page, which when clicked gives a view
of the full-sized version.


Hope this helps,

	Ross Moore


>
>
> Martin
>
> _______________________________________________
> latex2html mailing list
> latex2html at tug.org
> http://tug.org/mailman/listinfo/latex2html
>
------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------



More information about the latex2html mailing list