Debian Codegraph @

texk/dvipng/dvipng-src/dvipng.texi

raw
1 \input texinfo
2 @setfilename dvipng.info
3 @settitle A DVI-to-PNG translator
4 @ifset man
5 @c man begin SYNOPSIS
6 dvipng [options] filename
7
8 dvipng [options] [filename] -
9 @c man end
10 @end ifset
11
12 @set version 1.17
13 @set month-year January 2020
14
15 @c Put everything in one index (arbitrarily chosen to be the concept index).
16 @syncodeindex fn cp
17 @syncodeindex ky cp
18 @syncodeindex pg cp
19 @syncodeindex vr cp
20
21 @include macros.texi
22 @iftex
23 @tolerance 10000 @emergencystretch 3em
24 @end iftex
25
26 @dircategory TeX
27 @direntry
28 * DVI-to-PNG: (dvipng). Translating TeX DVI files to Portable Network Graphics (PNG).
29 * dvipng: (dvipng). A DVI-to-PNG translator.
30 @end direntry
31
32 @finalout
33 @titlepage
34 @title dvipng
35 @subtitle A DVI-to-PNG Translator
36 @subtitle Version @value{version}
37
38
39 @author by Jan-@AA{}ke Larsson.
40 @page
41 @vskip 0pt plus 1filll
42 Copyright @copyright{} 2002-2020 Jan-@AA{}ke Larsson
43
44 Permission is granted to make and distribute verbatim copies of
45 this manual provided the copyright notice and this permission notice
46 are preserved on all copies.
47
48 @ignore
49 Permission is granted to process this file through TeX and print the
50 results, provided the printed document carries copying permission
51 notice identical to this one except for the removal of this paragraph
52 (this paragraph not being relevant to the printed manual).
53 @end ignore
54
55 Permission is granted to copy and distribute modified versions of this
56 manual under the conditions for verbatim copying, provided also that the
57 section entitled ``Copying'' is included exactly as in the original, and
58 provided that the entire resulting derived work is distributed under the
59 terms of a permission notice identical to this one.
60
61 Permission is granted to copy and distribute translations of this manual
62 into another language, under the above conditions for modified versions,
63 except that this permission notice may be stated in a translation
64 approved by the Free Software Foundation.
65 @end titlepage
66 @page
67
68 @c @summarycontents
69 @contents
70
71 @ifnottex
72 @node Top
73 @top dvipng
74
75 This manual documents dvipng, a program to translate a DVI (DeVice
76 Independent) file into PNG (Portable Network Graphics).
77
78 This file documents dvipng version @value{version}
79
80 Corrections or perhaps rewrites of sections are @emph{very welcome}.
81
82 Jan-@AA{}ke Larsson
83
84 @end ifnottex
85
86 @menu
87 * Introduction:: Introduction
88 * Installation:: How to compile and install dvipng
89 * Basic usage:: First things first
90 * Command-line options:: Advanced usage
91 * Graphics:: Including PostScript and/or bitmaps
92 * Color:: Using color with dvipng
93 * Diagnosing problems:: Problems?
94 * Credits:: People who have contributed
95 * Copying:: GNU Lesser General Public License
96 * Index:: General index
97 @end menu
98
99
100
101 @node Introduction
102 @chapter Introduction
103
104 @c man begin DESCRIPTION
105 @include readme.texi
106 @c man end
107
108 @node Installation
109 @chapter Installation
110
111 @cindex configuration, of dvipng
112 @cindex compilation
113 @cindex installation, of dvipng
114
115 @include install.texi
116
117 @node Basic usage
118 @chapter Basic usage of dvipng
119
120 @cindex invoking dvipng
121
122 To use dvipng at its simplest, simply type
123
124 @example
125 dvipng foo
126 @end example
127
128 @noindent
129 where @file{foo.dvi} is the output of @TeX{} that you want to convert to
130 PNG format. If there are four pages in @file{foo.dvi}, those pages will
131 be output as @file{foo1.png}, @file{foo2.png}, @file{foo3.png}, and
132 @file{foo4.png}, respectively.
133
134 If you have enabled the PostScript font support (via FreeType),
135 fonts will be rendered as they are needed. Otherwise, dvipng will use
136 bitmapped (PK) fonts, and if you use PK fonts that have not been used on
137 your system before, they may be automatically generated; this process
138 can take a few minutes, so progress reports appear by default. The next
139 time the same font is used, it will have been saved on disk, so
140 rendering will go much faster. (If dvipng tries to endlessly generate
141 the same fonts over and over again, something is wrong. @xref{Unable to
142 generate fonts,,, kpathsea, Kpathsea}.)
143
144 Many options are available (see the next section). For a brief summary
145 of available options, just type
146
147 @example
148 dvipng --help
149 @end example
150
151 @node Command-line options
152 @chapter Command-line options
153
154 @cindex command-line options
155 @cindex options, dvipng
156
157 dvipng has a plethora of command line options. Reading through this
158 section will give a good idea of the capabilities of the driver.
159
160 @menu
161 * Option summary:: Quick listing, from dvipng --help.
162 * Option details:: More information about each option.
163 @end menu
164
165
166 @node Option summary
167 @section Option summary
168
169 @cindex options, summary
170 Here is a handy summary of the options; it is printed out when you run
171 dvipng with no arguments or with the standard @samp{--help} option.
172
173 @example
174 @include dvipng.help
175 @end example
176
177
178 @node Option details
179 @section Option details
180
181 @cindex option, details of
182 @c man begin OPTIONS
183
184 Many of the parameterless options listed here can be turned off by
185 suffixing the option with a zero (@samp{0}); for instance, to turn off
186 page reversal, use @samp{-r0}. Such options are marked with a trailing
187 @samp{*}.
188
189 @table @samp
190 @item -
191 @cindex options, reading from standard input
192 @cindex standard input, reading options from
193 Read additional options from standard input after processing the command
194 line.
195
196 @item --help
197 Print a usage message and exit.
198
199 @item --version
200 Print the version number and exit.
201
202 @item -bd @var{num}
203 @item -bd @var{color_spec}
204 @item -bd '@var{num} @var{color_spec}'
205 @cindex transparent border width
206 @cindex transparent border fallback color
207 Set the pixel width of the transparent border (default 0). Using this
208 option will make the image edges transparent, but it only affects pixels
209 with the background color. Giving a @var{color_spec} will set the
210 fallback color, to be used in viewers that cannot handle transparency
211 (the default is the background color). The color spec should be in
212 @TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. Setting the
213 fallback color makes the default border width 1 px. @xref{Color}.
214
215 @item --bdpi @var{num}
216 @cindex base resolution, setting
217 This option only has an effect when using bitmapped (PK) fonts. The
218 option sets the base (Metafont) resolution, both horizontal and
219 vertical, to @var{num} dpi (dots per inch). This option is necessary
220 when manually selecting Metafont mode with the --mode option (see
221 below).
222
223 @item -bg @var{color_spec}
224 @cindex background color (option)
225 Choose background color for the images. This option will be ignored if
226 there is a background color \special in the DVI. The color spec should
227 be in @TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'. You can
228 also specify 'Transparent' or 'transparent' which will give you a
229 transparent background with the normal background as a fallback color. A
230 capitalized 'Transparent' will give a full-alpha transparency, while an
231 all-lowercase 'transparent' will give a simple fully transparent
232 background with non-transparent antialiased pixels. The latter would be
233 suitable for viewers who cannot cope with a true alpha channel. GIF
234 images do not support full alpha transparency, so in case of GIF output,
235 both variants will use the latter behaviour. @xref{Color}.
236
237 @item -d @var{num}
238 @cindex debugging
239 Set the debug flags, showing what dvipng (thinks it) is doing. This will
240 work unless dvipng has been compiled without the @code{DEBUG} option
241 (not recommended). Set the flags as you need them, use @samp{-d -1} as
242 the first option for maximum output. @xref{Debug options}.
243
244 @item -D @var{num}
245 @cindex output resolution, setting
246 Set the output resolution, both horizontal and vertical, to @var{num}
247 dpi (dots per inch).
248
249 One may want to adjust this to fit a certain text font size (e.g., on
250 a web page), and for a text font height of @var{font_px} pixels (in
251 Mozilla) the correct formula is
252 @example
253 @var{dpi} = @var{font_px} * 72.27 / 10 [px * @TeX{}pt/in / @TeX{}pt]
254 @end example
255 The last division by ten is due to the standard font height 10pt in
256 your document, if you use 12pt, divide by 12. Unfortunately, some
257 proprietary browsers have font height in pt (points), not pixels. You
258 have to rescale that to pixels, using the screen resolution (default
259 is usually 96 dpi) which means the formula is
260 @example
261 @var{font_px} = @var{font_pt} * 96 / 72 [pt * px/in / (pt/in)]
262 @end example
263 On some high-res screens, the value is instead 120 dpi. Good luck!
264
265 @item --depth*
266 @cindex baseline reporting
267 @cindex depth reporting
268 Report the depth of the image. This only works reliably when the
269 @LaTeX{} style @file{preview.sty} from @previewlatex{} is used with
270 the @samp{active} option. It reports the number of pixels from the
271 bottom of the image to the baseline of the image. This can be used for
272 vertical positioning of the image in, e.g., web documents, where one
273 would use (Cascading StyleSheets 1)
274 @example
275 <IMG SRC="@var{filename.png}" STYLE="vertical-align: -@var{depth}px">
276 @end example
277 The depth is a negative offset in this case, so the minus sign is
278 necessary, and the unit is pixels (px).
279
280 @item --dvinum*
281 Set this option to make the output page number be the @TeX{} page
282 numbers rather than the physical page number. See the @samp{-o} switch.
283
284 @ignore
285 @item -e @var{num}
286 @cindex maxdrift
287 @cindex accuracy in positioning
288 @cindex positioning accuracy
289 Maximum drift in pixels of each character from its `true'
290 resolution-independent position on the page. The default value of this
291 parameter is resolution dependent (it is the number of entries in the
292 list [100, 200, 300, 400, 500, 600, 800, 1000, 1200, 1600, 2000, 2400,
293 2800, 3200, @dots{}] that are less than or equal to the resolution in
294 dots per inch). Allowing individual characters to `drift' from their
295 correctly rounded positions by a few pixels, while regaining the true
296 position at the beginning of each new word, improves the spacing of
297 letters in words.
298
299 @item -f*
300 @cindex filter, running as a
301 @cindex standard I/O
302 @cindex pipes, not readable
303 @vindex PRINTER@r{, avoided with @samp{-f}}
304 Run as a filter. Read the DVI file from standard input and write the
305 PostScript to standard output. The standard input must be seekable, so
306 it cannot be a pipe. If your input must be a pipe, write a shell script
307 that copies the pipe output to a temporary file and then points dvipng at
308 this file. This option also disables the automatic reading of the
309 @code{PRINTER} environment variable; use @samp{-P$PRINTER} after the
310 @samp{-f} to read it anyway. It also turns off the automatic sending of
311 control-D if it was turned on with the @samp{-F} option or in the
312 configuration file; use @samp{-F} after the @samp{-f} to send it anyway.
313
314 @item -k*
315 @cindex cropmarks
316 Print crop marks. This option increases the paper size (which should be
317 specified, either with a paper size special or with the @samp{-T}
318 option) by a half inch in each dimension. It translates each page by a
319 quarter inch and draws cross-style crop marks. It is mostly useful with
320 typesetters that can set the page size automatically. This works by
321 downloading @file{crop.pro}.
322 @end ignore
323
324 @item -fg @var{color_spec}
325 @cindex foreground color (option)
326 Choose foreground color for the images. This option will be ignored if
327 there is a foreground color \special in the DVI. The color spec should
328 be in @TeX{} color \special syntax, e.g., 'rgb 1.0 0.0 0.0'.
329 @xref{Color}.
330
331 @item --follow*
332 @cindex follow mode
333 Wait for data at end-of-file. One of the benefits of dvipng is that it
334 does not read the postamble, so it can be started before @TeX{}
335 finishes. This switch makes dvipng wait at end-of-file for further
336 output, unless it finds the POST marker that indicates the end of the
337 DVI. This is similar to @samp{tail -f} but for DVI-to-PNG conversion.
338
339 @item --freetype*
340 @cindex FreeType font rendering
341 Enable/disable FreeType font rendering (default on). This option is
342 available if the FreeType2 font library was present at compilation time.
343 If this is the case, dvipng will have direct support for PostScript
344 Type1 and TrueType fonts internally, rather than using @samp{gsftopk}
345 for rendering the fonts. If you have PostScript versions of Computer
346 Modern installed, there will be no need to generate bitmapped (PK)
347 variants on disk of these. Then, you can render images at different (and
348 unusual) resolutions without cluttering the disk with lots of bitmapped
349 fonts.
350 One reason to disable FreeType font rendering would be to generate
351 identical output on different platforms, since FreeType uses the native
352 renderer and therefore can give slightly different output on each platform.
353
354 @item --gamma @var{num}
355 @cindex gamma
356 @cindex dark fonts
357 @cindex light fonts
358 @cindex fuzzy images
359 Control the interpolation of colors in the greyscale anti-aliasing
360 color palette. Default value is 1.0. For 0 < @var{num} < 1, the
361 fonts will be lighter (more like the background), and for @var{num} >
362 1, the fonts will be darker (more like the foreground).
363
364 @item --gif*
365 @cindex GIF image format
366 The images are output in the GIF format, if GIF support is enabled.
367 This is the default for the @samp{dvigif} binary, which only will be
368 available when GIF support is enabled. GIF images are palette images
369 (see the @samp{--palette} option) and does not support true alpha
370 channels (see the @samp{--bg} option). See also the @samp{--png}
371 option.
372
373 @item --height*
374 @cindex baseline reporting
375 @cindex height reporting
376 Report the height of the image. This only works reliably when the
377 @LaTeX{} style @file{preview.sty} from @previewlatex{} is used with
378 the @samp{active} option. It reports the number of pixels from the top
379 of the image to the baseline of the image. The total height of the
380 image is obtained as the sum of the values reported from
381 @samp{--height} and @samp{--depth}.
382
383 @item -l [=]@var{num}
384 @cindex last page printed
385 @cindex page, last printed
386 @cindex physical page number, and @samp{-l}
387 @cindex absolute page number, and @samp{-l}
388 The last page printed will be the first one numbered @var{num}. Default
389 is the last page in the document. If @var{num} is prefixed by an equals
390 sign, then it (and the argument to the @samp{-p} option, if specified)
391 is treated as a physical (absolute) page number, rather than a value to
392 compare with the @TeX{} @samp{\count0} values stored in the DVI file.
393 Thus, using @samp{-l =9} will end with the ninth page of the document,
394 no matter what the pages are actually numbered.
395
396 @item --mode @var{mode}
397 @cindex mode name, specifying
398 @cindex Metafont mode, specifying
399 This option only has an effect when using bitmapped (PK) fonts. Use
400 @var{mode} as the Metafont device name for the PK fonts (both for path
401 searching and font generation). This needs to be augmented with the base
402 device resolution, given with the @samp{--bdpi} option. See the file
403 @url{ftp://ftp.tug.org/tex/modes.mf} for a list of resolutions and mode
404 names for most devices. @xref{Unable to generate fonts,,, kpathsea,
405 Kpathsea}.
406
407 @item -M*
408 @cindex font generation, avoiding
409 @pindex mktexpk@r{, avoiding}
410 @c this description repeated in kpathsea.texi
411 This option only has an effect when using bitmapped (PK) fonts. It turns
412 off automatic PK font generation (@file{mktexpk}).
413 @ignore
414 @flindex missfont.log
415 If @code{mktexpk}, the invocation is appended to a file
416 @file{missfont.log} (by default) in the current directory. You can then
417 execute the log file to create the missing files after fixing the
418 problem.
419 @vindex TEXMFOUTPUT
420 @vindex MISSFONT_LOG
421 If the current directory is not writable and the environment variable or
422 configuration file value @samp{TEXMFOUTPUT} is set, its value is used.
423 Otherwise, nothing is written. The name @samp{missfont.log} is
424 overridden by the @samp{MISSFONT_LOG} environment variable or
425 configuration file value.
426 @end ignore
427
428 @item --nogs*
429 @cindex GhostScript, turning off
430 This switch prohibits the internal call to GhostScript for displaying
431 PostScript specials. @samp{--nogs0} turns the call back on.
432
433 @item --nogssafer*
434 @cindex GhostScript and -dSAFER
435 @cindex -dSAFER
436 Normally, if GhostScript is used to render PostScript specials, the
437 GhostScript interpreter is run with the option @samp{-dSAFER}. The
438 @samp{--nogssafer} option runs GhostScript without @samp{-dSAFER}. The
439 @samp{-dSAFER} option in Ghostscript disables PostScript operators such
440 as deletefile, to prevent possibly malicious PostScript programs from
441 having any effect.
442
443 @item --norawps*
444 @cindex PostScript, turning off raw PostScript specials
445 Some packages generate raw PostScript specials, even non-rendering such
446 specials. This switch turns off the internal call to GhostScript
447 intended to display these raw PostScript specials. @samp{--norawps0}
448 turns the call back on.
449
450 @item -o @var{name}
451 @cindex output, redirecting
452 @cindex standard output, output to
453 Send output to the file @var{name}. A single occurrence of @samp{%d} or
454 @samp{%01d}, @dots{}, @samp{%09d} will be exchanged for the physical
455 page number (this can be changed, see the @samp{--dvinum} switch). The
456 default output filename is @samp{@var{file}%d.png} where the input DVI
457 file was @samp{@var{file}.dvi}.
458
459 @item -O @var{x-offset},@var{y-offset}
460 @cindex offset pages
461 Move the origin by @var{x-offset},@var{y-offset}, a comma-separated
462 pair of dimensions such as @samp{.1in,-.3cm}.
463 @c (@pxref{papersize special}).
464 The origin of the page is shifted from the default position
465 (of one inch down, one inch to the right from the upper left corner of
466 the paper) by this amount.
467
468 @item -p [=]@var{num}
469 @cindex first page printed
470 @cindex page, first printed
471 @cindex physical page number, and @samp{-p}
472 @cindex absolute page number, and @samp{-p}
473 The first page printed will be the first one numbered @var{num}. Default
474 is the first page in the document. If @var{num} is prefixed by an
475 equals sign, then it (and the argument to the @samp{-l} option, if
476 specified) is treated as a physical (absolute) page number, rather than
477 a value to compare with the @TeX{} @samp{\count0} values stored in the
478 DVI file. Thus, using @samp{-p =3} will start with the third page of
479 the document, no matter what the pages are actually numbered.
480
481 @item --palette*
482 @cindex forcing palette output
483 When an external image is included, @samp{dvipng} will automatically
484 switch to truecolor mode, to avoid unnecessary delay and quality
485 reduction, and enable the EPS translator to draw on a transparent
486 background and outside of the boundingbox. This switch will force
487 palette (256-color) output and make @samp{dvipng} revert to opaque
488 clipped image inclusion. This will also override the @samp{--truecolor}
489 switch if present.
490
491 @item --picky*
492 @cindex no erroneous images
493 No images are output when a warning occurs. Normally, dvipng will
494 output an image in spite of a warning, but there may be something
495 missing in this image. One reason to use this option would be if you
496 have a more complete but slower fallback converter. Mainly, this is
497 useful for failed figure inclusion and unknown \special occurrences,
498 but warnings will also occur for missing or unknown color specs and
499 missing PK fonts.
500
501 @item --png*
502 @cindex PNG image format
503 The images are output in the PNG format. This is the default for the
504 @samp{dvipng} binary. See also the @samp{--gif} option.
505
506 @item -pp @var{firstpage}-@var{lastpage}
507 @cindex page range
508 Print pages @var{firstpage} through @var{lastpage}; but not quite
509 equivalent to @samp{-p @var{firstpage} -l @var{lastpage}}. For example,
510 when rendering a book, there may be several instances of a page in the
511 DVI file (one in @code{\frontmatter}, one in @code{\mainmatter}, and one
512 in @code{\backmatter}). In case of several pages matching, @samp{-pp
513 @var{firstpage}-@var{lastpage}} will render @emph{all} pages that
514 matches the specified range, while @samp{-p @var{firstpage} -l
515 @var{lastpage}} will render the pages from the @emph{first} occurrence
516 of @var{firstpage} to the @emph{first} occurrence of @var{lastpage}.
517 This is the (undocumented) behaviour of dvips. In dvipng you can give
518 both kinds of options, in which case you get all pages that matches the
519 range in @samp{-pp} between the pages from @samp{-p} to @samp{-l}. Also
520 multiple @samp{-pp} options accumulate, unlike @samp{-p} and @samp{-l}.
521 The @samp{-} separator can also be @samp{:}. Note that @samp{-pp -1}
522 will be interpreted as "all pages up to and including 1", if you want a
523 page numbered -1 (only the table of contents, say) put @samp{-pp -1--1},
524 or more readable, @samp{-pp -1:-1}.
525
526 @item -q*
527 @cindex quiet operation
528 @cindex silent operation
529 @cindex warnings, suppressing
530 Run quietly. Don't chatter about pages converted, etc.@: to standard
531 output; report no warnings (only errors) to standard error.
532
533 @item -Q @var{num}
534 @cindex antialiasing levels@r{, number of}
535 @cindex quality
536 Set the quality to @var{num}. That is, choose the number of antialiasing
537 levels for bitmapped fonts (PK), to be
538 @var{num}*@var{num}+1. The default value is 4 which gives 17 levels of
539 antialiasing for antialiased fonts from these two. If FreeType is
540 available, its rendering is unaffected by this option.
541
542 @item -r*
543 @cindex reverse pagination
544 Toggle output of pages in reverse/forward order. By default, the first
545 page in the DVI is output first.
546
547 @ignore
548 @item -R
549 @cindex security
550 @cindex shell command execution, disabling
551 @cindex absolute filenames, disabling
552 @cindex pipes, disabling output to
553 Run securely. This disables shell command execution in @code{\special}
554 (via @samp{`}, @pxref{Dynamic creation of graphics}) and config files
555 (via the @samp{E} option, @pxref{Configuration file commands}), pipes as
556 output files, and opening of any absolute filenames.
557
558 @item -t @var{papertype}
559 @cindex paper type
560 @cindex media
561 @cindex letter papertype
562 @cindex legal papertype
563 @cindex ledger papertype
564 @cindex a4 papertype
565 @cindex a3 papertype
566 @cindex landscape papertype
567 Set the paper type to @var{papertype}.
568 @c usually defined in one of the
569 @c configuration files, along with the appropriate PostScript code to
570 @c select it (@pxref{Config file paper sizes}).
571 You can also specify a @var{papertype} of @samp{landscape}, which
572 rotates a document by 90 degrees. To rotate a document whose paper type
573 is not the default, you can use the @samp{-t} option twice, once for the
574 paper type, and once for @samp{landscape}.
575 @end ignore
576
577 @item --strict*
578 @cindex exit on erroneous images
579 The program exits when a warning occurs. Normally, dvipng will output
580 an image in spite of a warning, but there may be something missing in
581 this image. One reason to use this option would be if you have a more
582 complete but slower fallback converter. See the @samp{--picky} option
583 above for a list of when warnings occur.
584
585 @item -T @var{image_size}
586 Set the image size to @var{image_size} which can be either of
587 @samp{bbox}, @samp{tight}, or a comma-separated pair of dimensions
588 @var{hsize},@var{vsize} such as @samp{.1in,.3cm}. The default is
589 @samp{bbox} which produces a PNG that includes all ink put on the page
590 and in addition the DVI origin, located 1in from the top and 1in from
591 the left edge of the paper. This usually gives whitespace above and to
592 the left in the produced image. The value @samp{tight} will make dvipng
593 only include all ink put on the page, producing neat images.
594 @c (@pxref{papersize special}).
595 @c This option overrides any papersize special in the DVI file.
596
597 @item --truecolor*
598 @cindex truecolor output
599 This will make @samp{dvipng} generate truecolor output. Note that
600 truecolor output is automatic if you include an external image in your
601 DVI, e.g., via a PostScript special (i.e., the @samp{graphics} or
602 @samp{graphicx} package). This switch is overridden by the
603 @samp{--palette} switch.
604
605 @item -v*
606 Enable verbose operation. This will currently indicate what fonts is
607 used, in addition to the usual output.
608
609 @item --width*
610 @cindex width reporting
611 Report the width of the image. See also @samp{--height} and
612 @samp{--depth}.
613
614 @item -x @var{num}
615 @cindex magnification, overriding DVI
616 This option is deprecated; it should not be used. It is much better to
617 select the output resolution directly with the @samp{-D} option. This
618 option sets the magnification ratio to @math{@var{num}/1000} and
619 overrides the magnification specified in the DVI file. Must be between
620 10 and 100000. It is recommended that you use standard magstep values
621 (1095, 1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the
622 total number of PK files generated. @var{num} may be a real number, not
623 an integer, for increased precision.
624
625 @item -z @var{num}
626 @cindex compression
627 Set the PNG compression level to @var{num}. This option is enabled if
628 your @samp{libgd} is new enough. The default compression level is 1,
629 which selects maximum speed at the price of slightly larger PNGs. For an
630 older @samp{libgd}, the hard-soldered value 5 is used. The include file
631 @samp{png.h} says
632 @ifclear man
633 @quotation
634 Currently, valid values range from 0 - 9, corresponding directly to the
635 zlib compression levels 0 - 9 (0 - no compression, 9 - "maximal"
636 compression). Note that tests have shown that zlib compression levels
637 3-6 usually perform as well as level 9 for PNG images, and do
638 considerably fewer calculations. In the future, these values may not
639 correspond directly to the zlib compression levels.
640 @end quotation
641 @end ifclear
642 @ifset man
643 ``Currently, valid values range from 0 - 9, corresponding directly to
644 the zlib compression levels 0 - 9 (0 - no compression, 9 - "maximal"
645 compression). Note that tests have shown that zlib compression levels
646 3-6 usually perform as well as level 9 for PNG images, and do
647 considerably fewer calculations. In the future, these values may not
648 correspond directly to the zlib compression levels.''
649 @end ifset
650 @end table
651 @c man end
652
653 @node Graphics
654 @chapter Graphics
655
656 @samp{dvipng} attempts to handle graphics as included by the
657 @samp{graphicx} and @samp{graphics} packages, without the need of
658 specifying a driver to these packages. This means that it recognizes
659 the encapsulated postscript inclusion meant for @samp{dvips}, but is
660 also able (from version 1.8) to include bitmapped graphics. It also
661 tries to handle some of the raw PostScript that is output from various
662 packages. Some of the possibilities and problems are mentioned below.
663
664 @menu
665 * Encapsulated PostScript:: An internal call to GhostScript
666 * Bitmapped graphics:: PNG, JPEG and GIF
667 * Raw PostScript:: Ignore or give to GhostScript
668 @end menu
669
670 @node Encapsulated PostScript
671 @section Encapsulated PostScript
672
673 When an EPS file is included, a call to GhostScript is performed to
674 produce a bitmapped image that can be included. The default is to
675 produce an image with transparent background, at the same size as the
676 DVI page currently being converted to PNG, and include that as
677 foreground on the PNG. Of course, if the image is to be cropped, that
678 is done. The included image will be a truecolor image, so for maximum
679 performance the output PNG will be in truecolor mode as well.
680
681 This conversion needs the @samp{pngalpha} output device to be present
682 in your copy of GhostScript. If that device is not present, or you use
683 the @samp{--palette} switch or request GIF output, the fallback is to
684 use the @samp{png16m} device to produce a cropped opaque image for
685 inclusion. Other relevant switches are @samp{--noghostscript} and
686 @samp{--nogssafer}. @xref{Option details}.
687
688 @cindex PostScript inclusion problems
689 The most common problem with including graphics is an incorrect
690 bounding box. Complain to whoever wrote the software that generated
691 the file if the bounding box is indeed incorrect. An adjusted
692 boundingbox can be specified in the @samp{\includegraphics} call, as
693 in this example (using @samp{graphicx}):
694
695 @example
696 \includegraphics[bb=10 20 100 200]@{imagename.eps@}
697 @end example
698
699
700 @node Bitmapped graphics
701 @section Bitmapped graphics
702
703 dvipng can include PNG, JPEG and GIF graphics. When including such
704 images via @samp{\includegraphics} you need to specify the bounding
705 box since @TeX{} itself cannot read them from the files in question.
706 The bounding box size should be given as @samp{0 0 w h} in pixels,
707 e.g., if the file @samp{imagename.png} is 300x400 pixels, the
708 inclusion would read
709
710 @example
711 \includegraphics[bb=0 0 300 400]@{imagename.png@}
712 @end example
713
714 The default size is the image size in bp (``big points'' in TeX
715 nomenclature or PostScript points as other people have it, 72 per inch).
716 That is, default resolution will be 72 dpi for included bitmaps, which
717 is the default size in the few other bitmap-capable drivers that are
718 known to me (dvipdfm and PDFLaTeX).
719
720 If you want 100 dpi you need to specify the width accordingly. You
721 just divide your image width by 100: a 135 pixel wide image at 100 dpi
722 will take up 1.35 inches. If you want 200 dpi you divide by 200, and
723 so on. Simple, eh? The example above at 200 dpi would be 1.5 inches
724 wide:
725
726 @example
727 \includegraphics[bb=0 0 300 400,witdh=1.5in]@{imagename.png@}
728 @end example
729
730 @node Raw PostScript
731 @section Raw PostScript
732
733 dvipng attempts to handle raw PostScript. Rendering raw PostScript
734 specials is done on top of the page by including a transparent image
735 generated by the @samp{pngalpha} device in GhostScript (automatically
736 selecting @samp{truecolor} mode in dvipng).
737
738 Included PostScript headers are respected, and if the header
739 @samp{tex.pro} is included, dvipng also throws in @samp{color.pro} and
740 @samp{special.pro}. The package @samp{xcolor} includes its own headers
741 with color names, and this is not only kept as a PostScript header, but
742 is also read and interpreted by dvipng itself. An attempt is also made
743 to respect the PGF header. The non-rendering specials from
744 @samp{hyperref} are handled via some heuristics and do not give an
745 error.
746
747 Really rendering and moving things with raw PostScript specials is more
748 troublesome. The \rotatebox macro serves as a good example. The dvips
749 driver of the graphicx package surrounds DVI glyphs with PostScript code
750 so that after conversion by dvips, the glyphs (now themselves in
751 PostScript) will be rotated in the desired way. dvipng does not handle
752 this, at present. An attempt has been made to handle the rendering
753 specials output by PGF (tikz), and also PSTricks. Some things work, but
754 others do not. This is especially clear when mixing PostScript and DVI
755 rendering commands such as glyphs. dvipng cannot at present detect if
756 PostScript code moves @samp{currentpoint} or rotates the frame since
757 GhostScript does not return such information. A recommendation would be
758 to produce images from these packages as EPS files and include them into
759 your document in the standard manner.
760
761 Another way to handle this would be to use a slower fallback (with dvips
762 and gs, for example). If you want to disable raw PostScript handling in
763 dvipng, use the switch @samp{--norawps}. This switch turns off the
764 internal call to GhostScript intended to display these raw PostScript
765 specials. Further, when dvipng encounters raw PostScript and the gs call
766 is turned off, it gives a warning. It is now possible to use the switch
767 @samp{--picky} to disable page rendering of pages with warnings, and use
768 the slower fallback for these pages.
769
770 @node Color
771 @chapter Color
772
773 To support color, dvipng recognizes a certain set of specials as
774 generated by the @samp{color} and @samp{xcolor} style files. These
775 specials start with the keyword @samp{color} or the keyword
776 @samp{background}, followed by a color specification.
777
778 @menu
779 * Color specifications::
780 * Color specials::
781 @end menu
782
783
784 @node Color specifications
785 @section Color specifications
786
787 @cindex color specifications
788
789 The color specification supported by dvipng is by-value or by-name. The
790 by-value spec starts with the name of a color model (one of @samp{rgb},
791 @samp{hsb}, @samp{cmy}, @samp{cmyk}, or @samp{gray}) followed by the
792 appropriate number of parameters. Thus, the color specification
793 @samp{rgb 0.3 0.4 0.5} would correspond to the color that is @samp{0.3
794 0.4 0.5} in its red, blue and green values. The color model used
795 internally in dvipng is @samp{RGB} (discretized to 256 levels), for
796 details on the formulas used in conversion, see the @samp{xcolor}
797 documentation.
798
799 By-name color specifications are single (case-dependent) words and are
800 compared with color names defined in @samp{dvipsnam.def} (from the
801 @samp{graphics} bundle), @samp{svgnam.def} and @samp{xcolor.sty} (from
802 the @samp{xcolor} bundle). See the @samp{xcolor} documentation for a
803 list of names and the corresponding colors.
804
805 On the command-line, the name @samp{Transparent} can also be used as
806 an argument to @samp{--bg} to choose transparent background.
807 @xref{Option details}.
808
809 @node Color specials
810 @section Color specials
811
812 We will describe @samp{background} first, since it is the simplest. The
813 @samp{background} keyword must be followed by a color specification.
814 That color specification is used as a fill color for the background. The
815 last @samp{background} special on a page is the one that gets used, and
816 is used for the whole of the page image. (This is possible because the
817 prescan phase of dvipng notices all of the color specials so that the
818 appropriate information can be written out during the second phase.)
819
820 The @samp{color} special itself has three forms. The first is just
821 @samp{color} followed by a color specification. In this case, the
822 current global color is set to that color; the color stack must be empty
823 when such a command is executed.
824
825 The second form is @samp{color push} followed by a color specification.
826 This saves the current color on the color stack and sets the color to be
827 that given by the color specification. This is the most common way to
828 set a color.
829
830 The final form of the @samp{color} special is just @samp{color pop},
831 with no color specification; this says to pop the color last pushed on
832 the color stack from the color stack and set the current color to be
833 that color.
834
835 dvipng correctly handles these color specials across pages, even when
836 the pages are rendered repeatedly or in reverse order.
837
838 @node Diagnosing problems
839 @chapter Diagnosing problems
840
841 @cindex problems
842 @cindex trouble
843 @cindex debugging
844
845 You've gone through all the trouble of installing dvipng, carefully read
846 all the instructions in this manual, and still can't get something to
847 work. The following sections provide some helpful hints if you find
848 yourself in such a situation.
849
850 @menu
851 * Contact information:: Who to ask.
852 * Debug options:: Getting diagnostics.
853 @end menu
854
855 @node Contact information
856 @section Contact information
857
858 Bug reports should be sent to
859 @email{dvipng@@nongnu.org}.
860
861 Questions, suggestions for new features, pleas for help, and/or praise
862 should go to @email{dvipng@@nongnu.org}. For more information on this
863 mailing list, send a message with just the word `help' as subject or
864 body to @email{dvipng-request@@nongnu.org} or look at
865 @url{http://lists.nongnu.org/mailman/listinfo/dvipng}.
866
867 Offers to support further development will be appreciated. For developer
868 access, ask on @email{dvipng@@nongnu.org}.
869
870 For details on the @TeX{} path-searching library, and @code{mktexpk}
871 problems, @pxref{Common problems,,, kpathsea, Kpathsea}.
872
873
874 @node Debug options
875 @section Debug options
876
877 The @samp{-d} flag to dvipng helps in tracking down certain errors. The
878 parameter to this flag is an integer that tells what errors are
879 currently being tracked. To track a certain class of debug messages,
880 simply provide the appropriate number given below; if you wish to track
881 multiple classes, sum the numbers of the classes you wish to track. To
882 track all classes, you can use @code{-1}.
883
884 Some of these debugging options are actually provided by Kpathsea
885 (@pxref{Debugging, , , kpathsea, Kpathsea}).
886
887 The classes are:
888 @table @asis
889 @item 1
890 Normal dvi op-codes
891 @item 2
892 Virtual fonts
893 @item 4
894 PK fonts
895 @item 8
896 TFM files
897 @item 16
898 Glyph rendering
899 @item 32
900 FreeType calls
901 @item 64
902 Encoding loads
903 @item 128
904 Color specials
905 @item 256
906 GhostScript specials
907 @item 512
908 Kpathsea @code{stat} calls
909 @item 1024
910 Kpathsea hash table lookups
911 @item 2048
912 Kpathsea path element expansion
913 @item 4096
914 Kpathsea path searches
915 @ignore
916 @item 8192
917 @item 16384
918 @end ignore
919
920 @end table
921
922 @node Credits
923 @chapter Credits
924
925 A number of persons have contributed, if I forget to mention someone,
926 I apologize. First and foremost we have David Kastrup whose
927 @previewlatex{} project provided the incentive to write this program.
928 There is also a number of people who have contributed by reporting
929 bugs and suggesting improvements as the thing has evolved. These
930 include but is perhaps not limited to (in semi-random order): Thomas
931 Esser (te@TeX{}), Christian Schenk (MIK@TeX{}), Brian R Furry (debian
932 package), Angus Leeming (LyX), Thomas Boutell (libgd), John Jones
933 (first user report), Uwe Kern (xcolor), Karl Berry and Peter
934 Breitenlohner (@TeX{} Live), David Harvey (hinting in Freetype), Neal
935 Harmon, Alan Shutko, Reiner Stieb, Nick Alcock, Adam Buchbinder, Svend
936 Tollak Munkejord, James Longstreet, Bernhard Simon, Bob McElrath,
937 Georg Schwarz, Jason Farmer, Brian V. Smith, Samuel Hathaway, Thomas
938 R. Shemanske, Stephen Gibson, Christian Ridderstr@"om, Ezra Peisach,
939 William H Wheeler, Thomas Klausner, Harald Koenig, Adrian Bunk, Kevin
940 Smith, Jason Riedy, Wolfram Krause, Reinhard Kotucha, Takeshi Abe,
941 Waldeck Schutzer, Ahzo, and Andy Nguyen.
942
943 @ifset man
944 @c man begin NOTES
945 The full manual is accessible in info format, on most systems by typing
946 @example
947 info dvipng
948 @end example
949 @c man end
950 @c man begin COPYRIGHT
951 This program is released under the GNU Lesser General Public License
952 version 3, see the COPYING file in the dvipng distribution or
953 @url{http://www.gnu.org/licenses/gpl.html}.
954
955 Copyright @copyright{} 2002-2015, 2019 Jan-@AA{}ke Larsson
956 @c man end
957 @end ifset
958
959 @node Copying
960 @chapter Copying
961
962 This program is free software: you can redistribute it and/or modify
963 it under the terms of the GNU Lesser General Public License as
964 published by the Free Software Foundation, either version 3 of the
965 License, or (at your option) any later version.
966
967 This program is distributed in the hope that it will be useful, but
968 WITHOUT ANY WARRANTY; without even the implied warranty of
969 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
970 Lesser General Public License for more details.
971
972 You should have received a copy of the GNU Lesser General Public
973 License along with this program. If not, see
974 <http://www.gnu.org/licenses/>.
975
976 @sp 2
977 @noindent
978 Copyright @copyright{} 2002-2015, 2019 Jan-@AA{}ke Larsson
979
980 @node Index
981 @unnumbered Index
982
983 @printindex cp
984 @bye