Bmeps converts PNG, JPEG and NetPBM to EPS and PDF. The project source archive also cotains a library which can be linked into dvips.
What license applies to the package?
Which file types are supported?
PNG, JPEG and NetPBM files can be read. PNG is the preferred input file format as it provides a good compression rate, the compression is not lossy and files may contain an alpha channel (used for transparency).
The PNG file format is a good choice for "artificial" pictures (logos, screenshots...).
The JPEG file format is a good choice for "natural scenes)
(i.e. photos).
The DCT compression used by the JPEG file format is a lossy compression.
Typically a user can set up the image qualitiy (and the amount of loss)
in dialog boxes of applications producing JPEG images.
NetPBM should be used as intermediate file type in pipes.
Bmeps can read TIFF files using the
TIFFReadRGBAImage() function from the TIFF library.
TIFF support was added to be able to convert fax files from a fax gateway
from TIFF to PDF. This was tested successfully. Use of other TIFF files
with bmeps is not recommended. If bmeps fails to read a TIFF file, convert
the TIFF file to PNG using your favourite graphics program and let bmeps
read the PNG file.
The TIFF file format is a collection of different compression and
encoding mechanisms. The TIFF V6.0 baseline standard lists a number
of TIFF tags, but some software vendors also use non-standard tags
when writing TIFF files. You should not be surprised if bmeps fails
to convert a TIFF file. If you have a choice, use PNG files instead.
Source code and documentation can be found at http://sourceforge.net/projects/bmeps.
What other software is required to install bmeps?
Install the libraries in the given order, set the environment variables CPPFLAGS, CFLAGS and LDFLAGS so the header files and libraries are found.
How do I configure C compiler and linker to build dklibs and bmeps?
See the dklibs FAQ: Unix/Linux installation FAQ section.
How do I install the bmeps library?
Unpack the source archive, change into the bmeps directory and run
./configure make make install
[Linux] How do I build and install a shared library version?
/usr/local/lib
./configure make -f Makefile-shared-linux make -f Makefile-shared-linux install ldconfig
./configure make -f Makefile-shared-linux make -f Makefile-shared-linux install ldconfig
[Solaris, Sun Workshop compilers] How do I build and install a shared library version?
./configure make -f Makefile-shared-solaris-workshop make -f Makefile-shared-solaris-workshop install
./configure make -f Makefile-shared-solaris-workshop make -f Makefile-shared-solaris-workshop install
How do I build the modified dvips driver?
As I did not build a modified dvips driver for a long time
(there was no need to do so as I have enough disk space available
now) I can no longer give detailed recommendations.
In ``good old times'' the current dvips sources were available
in the tetex distribution sources on CTAN. I don't know where
to find them today. So I can not derive modified dvips sources
from the original.
I can only recommend to run a diff command to compare the modified
dvips sources in the dvips-mods/595a directory against the original
dvips 595a sources to find the changes you have to apply to
the dvips sources.
Where can I get a binary bmeps.exe?
In the download section of
http://sourceforge.net/projects/dklibs
there are two executable setup files: dklibs-win32-*-user.exe and
dklibs-win32-*-base.exe. The *-user.exe is the recommended setup, it installs
binaries and documentation locally on the hard disk.
The *-base.exe setup only installs the binaries locally, start menu entries
for documentation will point to web resources. You should use this setup
only if you really need to save disk space and the computer is permanently
connected to the internet.
For previous versions (1.x.x) a Windows binary was shipped with the
source package of bmeps.
Bmeps 2.x.x uses the dklibs library set and needs
the supplemental files (libraries, string tables...), so it can not
run without the dklibs library set.
How do I build bmeps.exe from source?
There's a special source archive for Windows in the dklibs-win32 package
of the dklibs library set at
http://sourceforge.net/projects/dklibs in the download area.
This source archive contains the code for dklibs and some applications using
the dklibs library set (bmeps is one of them).
See
dklibs FAQ: Windows installation from source FAQ for
details about the build process.
Where can I get a Win32 binary of the modified dvips?
The MikTeX distribution includes a dvips
containing the bitmap support.
See http://www.miktex.org.
The last MikTeX distribution I tested contained bmeps 1.54 - a very old
version.
How can I create a context menu entry in the Windows explorer to convert fax files to PDF?
bmeps -leps input.png output.eps
bmeps -lps input.png output.ps
bmeps -lpdf input.png output.pdf
bmeps -lbb input.png output.bb
What are the easiest to use bmeps command lines?
The most simple way to convert an input image to EPS, PS, PDF or bb using bmeps is to run one of the commands
bmeps input.png output.eps bmeps input.png output.ps bmeps input.png output.pdf bmeps input.png output.bb
Note: If the ``-l'' option is omitted bmeps inspects the output file name suffix to find an appropriate output configuration. If you want to overwrite configuration entries using the ``-o'' option, place these options after the output file name.
Why should I avoid forward-and-backward conversion?
You might loose information (this means the result is not looking exactly as the original) when doing unnecessary forward-and-backward conversions for three reasons:
-o i=n
So if you convert an image img1.png to img1.eps and then img1.eps to test.png the files img1.png and test.png will not necessarily be 100 percent equal.
What is ``image interpolation''?
If the interpolation flag is set to true for an image
EPS and PDF viewers are allowed to attempt quality improvements for
better on-screen rendering.
The
bt9.pdf
file shows the effect. The first foil includes a PNG file (without
interpolation flag set), the second foil includes a PDF file
(interpolation flag is set to ``true''). When switching between
the foils look at the edges of the 5-minutes-circles and the edges
of the pointers.
What is a ``predictor'', should I use it?
Prediction is a technique used in combination with flate compression
and LZW compression (not available in bmeps) to produce smaller output
files. Instead of passing each color value to flate compression directly
a prediction for the color value is calculated, the difference between
the current color value and the predicted value is passed to the flate
compression.
Different prediction mechanisms can be used:
tiff | The predicted value is the same as the corresponding value from
the point to the left. This predictor can be used with any number of bits per component. |
png-sub | All the png-... predictors can be used with
8 bits per component or 16 bits per component only. The predicted value for each byte is the value of the corresponding byte from the point to the left. |
png-up | The predicted value for each byte is the value of the corresponding byte from the point one row above. |
png-average | The predicted value for each byte is the average of the corresponding bytes from the point to the left and the point one row above. |
png-paeth | The predicted value for each byte is calculated from the corresponding bytes of the point at the left, the point above and the point left above. See RFC 2083 for the calculation algorithm. |
The color values and byte values for unavailable points (left from column 0 or above row 0) are 0.
For ``normal'' PNG images like screenshots, logos... there is no need
to use a predictor.
For very special cases (i.e. photos saved as PNG, not JPEG or for
images containing color gradients) you will need a predictor.
General rule: If you convert a PNG to PDF and the file size increases
significantly more than 25 % you should attempt to use a predictor.
The predictor to use depends on the input image, so you should attempt
different predictors to find the best possible result.
I suggest to attempt ``tiff'' and ``png-paeth'' first, in my tests they showed
the best results.
Why are the PDFs produced by bmeps larger than the source PNGs and JPEGs?
Normally the PDFs produced by bmeps are ~25 percent larger than the original PNG or JPEG file because bmeps does not save binary data. Binary data is encoded ASCII-85 to ensure I can open the files produced by bmeps in a text editor. This allows me to inspect the PDF files for debugging.
In addition to flate compression the PNG file format allows the use
of palettes and predictors.
Palettes are not available in PDF (at least I did not find them in the
PDF 1.4 specification). Predictors can be used with bmeps when
producing PDFs, but you can only specify one predictor which is used for
all image rows. In PNG files predictors can be specified for rows.
What must I do in my LaTeX source to use bitmap graphics?
When using an unmodified dvips add
\DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1}
to your LaTeX preamble.
Now dvips attempts to run the bmeps program for each included image
using the default options configured by ``bmeps -c ...''.
Alternatively you can use
\DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps -leps2 #1}
to set the EPS version.
When running dvips make sure to allow the execution of external commands.
When using the modified dvips add
\DeclareGraphicsRule{.png}{eps}{.bb}{}
to the document preamble.
To calcaluate the documents layout LaTeX needs information
about the bounding boxes of included graphics.
In EPS files this information is contained in a line like
%%BoundingBox: 0 0 800 600
directly in the file.
Other file types do not allow text lines in the file, a separated
file must contain this information.
Use
bmeps -lbb file.png file.bb
to create the bounding box file file.bb for
file.png.
Do not use the ebb program coming with some LaTeX distributions
in conjunction with bmeps.
Bmeps and ebb use different formulas to calculate the BoundingBox:
Should I use the resolution chunk?
If you convert a bitmap image to EPS or PDF for use with LaTex or pdfLaTeX there are two ways to specify the size of the image on the page:
\includegraphics{image}without the optional width argument. The image size is given by the %%BoundingBox or /MediaBox of the EPS or PDF file.
\includegraphics[width=8cm]{image}contains information about the image size on the page you want. LaTex/pdfLaTeX uses this information and the %%BoundingBox or /MediaBox information to calculate correct scale factors.
I prefer version 2 for two reasons:
JPEG files, resolution in dots per centimeter: | 1.67 dpi |
PNG file, resolution in dots per meter: | 0.0165 dpi |
PNG file, resolution in dots per centimeter: | 1,67 dpi |
TIFF file, resolution in dots per centimeter: | 1,67 dpi |
all file types/resolution units not listed above: | 0.00001 dpi |
Can I use PNGs with both latex/dvips and pdflatex?
Of course you can.
In your documents preamble (before \begin{document}) write
\usepackage{ifpdf} \ifpdf ... \else \DeclareGraphicsRule{.png}{eps}{.bb}{} \fi
for modified dvips or
\usepackage{ifpdf} \ifpdf ... \else \DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1} \fi
for unmodified dvips.
If your document contains EPS graphics too, you should change
\includegraphics[...]{xxx.eps}
to
\includegraphics[...]{xxx}
and provide both an EPS and a PDF version of the picture.
Use
ps2pdf xxx.eps xxx.pdf
or - for large pictures -
cat xxx.eps | epsffit -c 87 92 487 363 | ps2pdf - xxx.pdf
to convert the EPS file to PDF.
The epsffit program is contained in the psutils
(http://www.dcs.ed.ac.uk/home/ajcd/psutils/index.html).
The ps2pdf script is contained in the Gostscript distributions.
(http://www.cs.wisc.edu/~ghost)
Which options are recognized by bmeps?
See the Usage page for information.
How can I use bitmap graphics with the modified dvips?
Options for bitmap-to-EPS-conversion can be specified on the command line. Use
dvips -I <configuration-name> ...
where <configuration-name> is the same as the ``-l'' argument
to the bmeps program (a configuration name, configuration entry
overwrites optionally appended separated by comma).
Examples:
dvips -I eps1 ...
dvips -I eps2,color=no ...
dvips -I eps2 ...
How can I configure default settings?
Both bmeps and the modified dvips retrieve
default settings from the EPSOUTPUT environment variable
before processing command line options.
The contents of the variable must be the same as the argument to
the -I option of the modified dvips as
explained in the section above.
This variable can be set in your login scripts, i.e.
setenv EPSOUTPUT eps2,color=no
in .cshrc or
EPSOUTPUT="eps2,color=no" export EPSOUTPUT
in .profile or
set EPSOUTPUT="eps2,color=no"
in AUTOEXEC.BAT.
Is there a template to see how things work?
Here I show a template how to use the bmeps with an unmodified dvips.
\documentclass[ngerman,12pt,a4paper]{scrartcl} \usepackage{ngerman} \usepackage{ifpdf} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{textcomp} \usepackage{mathptmx} \usepackage[scaled=.92]{helvet} \usepackage{courier} \usepackage{array} \usepackage{enumerate} \usepackage{longtable} \usepackage{latexsym} \usepackage[ngerman]{varioref} \usepackage{makeidx} \usepackage{color} \ifpdf \usepackage[activate=normal]{pdfcprot} \usepackage[pdftex]{graphicx} % % - The epstopdf package requires the write18 feature to invoke % eps -> pdf conversion from pdfLaTeX. To enable it use % - -shell-escape command line option (recommended) % - write18=enable in miktex.ini or (not recommended, security risk) % - shell_escape=1 in texmf.cnf or (not recommended, security risk) % - on Windows there are errors if epstopdf is invoked by pdfLaTeX % (possibly the epstopdf program does not set stdout to binary mode?) % \usepackage{epstopdf} \pdfcompresslevel=9 \usepackage[ pdftex, a4paper=true, pdftitle={Test}, pdfsubject={Test}, pdfauthor={Dipl.-Ing. D. Krause}, colorlinks=true, linkcolor=linkgreen, pdfpagemode=None, pdfstartview=FitH ]{hyperref} \definecolor{linkgreen}{rgb}{0,0.5,0} \else \usepackage[dvips]{graphicx} \DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.jpg}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.jpeg}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.pgm}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.pbm}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.pnm}{eps}{.bb}{`bmeps #1} \DeclareGraphicsRule{.ppm}{eps}{.bb}{`bmeps #1} \usepackage[ dvips, colorlinks=true, linkcolor=linkgreen ]{hyperref} \definecolor{linkgreen}{rgb}{0,0.5,0} \fi \setlength{\parindent}{0cm} \author{Dipl.-Ing.~D.~Krause} \title{Test mit Bildformaten} \renewcommand*{\sectfont}{\bfseries} \makeindex \begin{document} \begin{sloppy} \newpage \section{Test} This is a test for graphics inclusion. \begin{figure} {\centering \includegraphics[width=\linewidth]{arch5.jpg} \caption{Delicate Arch} } \end{figure} \end{sloppy} \end{document}
This template allows to use latex+dvips and pdflatex (latex+dvipdfm
was not testet).
It is the template I use when writing new documents, may bee you need
other packages and options.
The DeclareGraphicsRule is used only when not running
pdftex/pdflatex/.
Can I use PDF images created by bmeps containing alpha transparency with pdfLaTeX?
Yes, you can.
Add a line
\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
to the LaTeX source preamble
(suggested by J. Quirk in the pdftex mailing list).
If bmeps transfers alpha channels from PNG or TIFF to PDF a notification
is printed to remind you to use that line in the preamble.
How can I get rid of the "At least one alpha channel..." message?
The message
At least one alpha channel was converted to PDF. When referencing PDFs containing alpha data from your *.tex sources, you should use \ifpdf\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}\fi in the preamble.
or the german version
Ein Alpha-Kanal wurde in eine PDF-Ausgabe übertragen. Um PDFs mit Alpha-Kanal mit pdfLaTeX zu verwenden, sollten Sie \ifpdf\pdfpageattr{/Group <>}\fi in der Präambel der LaTeX-Quelle verwenden.
is printed if bmeps converts PNG or TIFF file containing alpha
channel data to PDF, transferring the alpha channel.
To turn this message off, either use the -A command line
argument or set the preference "/pdf/suppress-alpha-info" to "true".
On Unix/Linux edit $HOME/.defaults/all and add a section
[bmeps] /pdf/suppress-alpha-info=true
On Windows go to the registry key (create the key if it does not exist) HKCU\Software\DkApp\bmeps and add an entry
"*:/pdf/suppress-alpha-info"=(REG_SZ)"true"
Instead of the asterisk ("*") you can use the computer name.
Alternatively run
bmeps -c -A
to set -A as a permanent option.
What's the purpose of this script?
The mkpdfsls.pl script can be used to create a slide show, i.e. for images from your digital camera.
Which other software is required to run this script?
Where can I obtain the Image::ExifTool and DKrause::LaTeXEncoder modules?
The Image::ExifTool module is available on CPAN.
The DKrause::LaTeXEncoder module is shipped with the dklibs
library set
(http://sourceforge.net/projects/dklibs). After unpacking the source archive you will find the
module source in the perlxs subdirectory. Change into the
DKrause-LaTeXEncoder directory and run:
perl Makefile.PL make make install
to install the module.
What must I do to create a slide show?
mkpdfsls.pl holidays.mks
How do I create a project file?
ls *.jpg | sort > holidays.mks
presentation maker = beamerand add author and title information...
[options] presentation maker = beamer theme = Madrid background = black author = John Doe title = Holidays in Scotland [files] scot01.jpg = Nice Landscape scot02.jpg = Yet another landscape view scot03.jpg = Holyrood palaceIf your JPEG files contain comments (stored in the ``Comment'' EXIF tag) you can use these commens instead of writing all the comments again:
[options] presentation maker = beamer theme = Madrid background = black author = John Doe title = Holidays in Scotland use exif = yes [files] scot01.jpg scot02.jpg scot03.jpg
How does mkpdfsls.pl create a slide show?
pdftk input1.pdf input2.pdf input3.pdf ... cat output slide-show.pdfUse the
presentation maker = pdftkoption in the project file to activate this mechanism.
presentation maker = plainoption in the project file to activate this mechanism.
presentation maker = beameroption to activate this mechanism.
How can I export MS Excel charts to EPS using bmeps?
A VB macro ChartPict_save() -
placed in
contrib/kant_krishna/excel_to_eps.vbs
-
was provided by Krishna Kant to export all charts to
PNG files and run bmeps on these files.
Note (1): This macro is provided "as-is", no support for it as
I have no knowledge of VB. I tested the macro on Office Prof. 2003,
works fine. On earlier Office version (i.e. Office 97 Prof.) there
were problems.
Note (2): This conversion produces bitmap graphics EPS files.
Possibly you want to try exporting to WMF and use the wmf2eps program
to obtain vector graphics EPS files.
Are there command line options for integration into Windows explorer?
To create context menu entries for bmeps use the ``-a'' option, create commands like
bmeps -a -lbb "%1"
Why do I get errors "dvips: ... couldn't find ... file ..."?
The dvips driver uses the kpathsea library to locate files.
This library assumes a directory structure having a so called BASEDIR.
Executable files are expected to be in BASEDIR/bin/<architecture>.
When searching for a file the library estimates the directory where
the executable for the current process was taken from, goes up two
directory levels and treats that directory as BASEDIR.
In BASEDIR/share/texmf there is a file ls-R containing the file name
database. This file is needed by kpathsea to find files.
Type
which dvips
to find where your dvips is located. If it is in a directory
BASEDIR/bin move it to
BASEDIR/bin/<architecture>.
Why doesn't dvips convert my pictures?
Probably the original dvips is used. Type
dvips --version
If the first output line looks like
dvips(k) 5.86
you are using an unmodified dvips. If it looks like
dvips(k) 5.86 modified for bitmap graphics support
the dvips version is correct.
[Linux] How do I avoid the crash occuring after the splash screen?
Instead of
bmeps-gui
run
bmeps-gui -splash:none
What does ``Failed to run program.'' mean?
If you see this error message the bmeps or bmeps.exe file was not found.
Make sure this file is in one of the directories listed in the PATH
environment variable.