← TOC | ↑ Home | LaTeX document | → | EPS | SVG | PNG | JPEG | ICO | XPM |
This page shows how to convert a LaTeX document x.tex into an XPM image.
When converting vector graphics to bitmap images (like XPM) you have to specify a resolution. This is the number of pixels per inch.
To create a toolbar button image, prepare the image as 1 inch (width) × 15/16 inch (height) rectangle and use a resolution of 16.
gxhconvert -o=xpm -r=16 x.tex
See the [gxhconvert manual] for a full description of the gxhconvert script.
Option | Purpose |
---|---|
-r=... | Resolution in dpi (dots per inch). |
-a --alpha |
Create alpha channel. Untouched input regions result in transparent output regions. |
pdflatex -interaction=nonstopmode x
pdf2svg x.pdf x.svg
inkscape --batch-process --export-type=png --export-overwrite --export-filename=x-16.png --export-dpi=_resolution_ --export-area-page x.svg
pngtopam -alpha x-16.png > x-16.pgm
pngtopam -mix x-16.png | pnmquant 16 | ppmtoxpm -name _name_ -hexonly -alphamask=x-16.pgm > x.xpm
The name argument in the ppmtoxpm command must be a valid
identifier (variable name) in the C programming languange.
Replace "static char" by "static const char" at the start of the file.
pdflatex -interaction=nonstopmode x
pdftoppm -r 16 x.pdf | pnmquant 16 | ppmtoxpm -name <i>name</i> -hexonly > x.xpm
The name argument in the ppmtoxpm command must be a valid
identifier (variable name) in the C programming languange.
Replace "static char" by "static const char" at the start of the file.
← TOC | ↑ Home | LaTeX document | → | EPS | SVG | PNG | JPEG | ICO | XPM |