bmeps + dvips add-on

Usage


Mod. dvips   /   Bmeps options   /   Defaults   /   Alpha channel   /   Examples

It depends on your installation (modified or unmodified dvips) how to use bitmap graphics support.


Using the modified dvips

Preparing LaTeX sources

In the header section of your TeX source write

	\DeclareGraphicsRule{.png}{eps}{.bb}{}
	\DeclareGraphicsRule{.jpg}{eps}{.bb}{}
	\DeclareGraphicsRule{.jpeg}{eps}{.bb}{}

This advises LaTeX to treat PNG/JPEG graphics as EPS. Bounding box information is retrieved from files having the suffix .bb. The bmeps program can be used to create .bb-files, i.e.
	bmeps -b file1.png file1.bb
creates the bounding box for graphics file file1.png and stores the bounding box data into file1.bb.
You can use shell scripts like the following to create bounding box files for all PNG files in a given directory:
	#! /bin/csh
	foreach png (*.png)
	  set j = $png:r
	  set bb = ${j}.bb
	  bmeps -b ${png} ${bb}
	end

New dvips command line options

Options can be given on command line via

	-I <conversion-options>

where conversion-options is a string containing the following characters: If no command line options are given dvips consults the environment variable EPSOUTPUT.

Option examples

Option defaults

Be default dvips is configured for PS level 2, grayscale printing and uses run-length-encoding in combination whit ASCII-85-encoding.


Using the unmodified dvips

If you did not install the modified dvips you can add the following line in your LaTeX source's preamble:

	\DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps -p2 -g -er8 #1}
	\DeclareGraphicsRule{.jpg}{eps}{.bb}{`bmeps -p2 -g -er8 #1}
	\DeclareGraphicsRule{.jpeg}{eps}{.bb}{`bmeps -p2 -g -er8 #1}
This advises the dvixxx drivers to run bmeps -p2 -g -er8 <inputfile> for all PNG/JPEG pictures to create EPS output.
Note: If you need different PS output from the same LaTeX source (i.e. colored and flated output for conversion to PDF and grayscaled run-length and ASCII85 output for a printer) you should not specifiy options to bmeps. In this case you should provide options via the EPSOUTPUT environment variable as shown in the next section when running dvips. The graphics rule in this case looks like:
	\DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1}



 

Configuring defaults

If you do not want to specifiy EPS output configuration on command line each time you use bmeps or the modified dvips you can set defaults in the EPSOUTPUT environment variable.
The contents of this variable is the same as the argument to the -I option for the modified dvips as explained above.
Examples:
Use

	setenv EPSOUTPUT 2gr8
in your .cshrc file if your login shell is a C-Shell.
Use
	EPSOUTPUT=2gr8
        export EPSOUTPUT
in your .profile file if your login shell is a Bourne-shell.
On W*-systems use
	set EPSOUTPUT=2gr8
in your autoexec.bat file.



 

Examples

The EXAMPLES subdirectory contains Postscript files derived from the same example.tex file using different options.
The image stefan_255_rgba.png was obtained from the "Miscallenous Transparent PNGs Using Image Tags" page on the libpng home page.
ImageLaTeX source

 
Some levels of gray in this image are produced by specifying a black foreground, a white background and an alpha channel value for mixing.
 
\documentclass[titlepage,12pt]{article}
\usepackage{a4}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[latin1]{inputenc}
\parindent0cm
\usepackage{longtable}
\usepackage{varioref}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[dvips]{color}
%
% The pagecolor instruction in the line below was used
% to produce the bg...ps files.
%
% \pagecolor{cyan}

% \DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1}
\DeclareGraphicsRule{.png}{eps}{.bb}{}

\geometry{body={17cm,22cm},top=1cm,left=2.5cm}
\makeindex
\begin{document}
\begin{sloppy}
\section{Example}
The options \texttt{1g} were used to create this file.
\begin{figure}
\begin{center}
\caption{Bird}
\includegraphics[width=4cm]{stefan_255_rgba.png}
\end{center}
\end{figure}
\end{sloppy}
\end{document}
The hyperlinks in this section point to the PS output file. Additionally we have screenshots showing the PS output in the gv program.
 
First we show some simple usage examples:


 
Now we show how to deal with the alpha channel.
The line
\pagecolor{cyan}
in the TeX source file was activated to establish a page background color.
 
To create a draft file using placeholders for bitmap images only one can use the d option, a result is shown in d.ps.
 

 


Dirk Krause     d.krause@e-technik.fh-schmalkalden.de     2002/11/11 http://www.e-technik.fh-schmalkalden.de/personen/dhp/krause/pages/software/bmeps/usage.html