GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
a2png(1) USER COMMANDS a2png(1)

a2png - convert ASCII text to PNG bitmap image

a2png [ options ] [ file(s) ]

a2png reads text from files or standard input and renders them to a PNG bitmap image. The first version is pretty simple, and will only handle newlines, carriage returns and tabs -- ANSI schemes is not supported.

The Cairo graphics library is used for rendering the file in memory.

-
Read text from standard input
--background=...
Set background color. The format is the same as for HTML/CSS, i.e. aabbcc, in RGB values. Default is black (000000).
--bold
Use bold font.
--charspacing=...
Set horizontal spacing between characters in pixels. Default is 0. You can also use negative.
--fixed
Make any font fixed-width by using the horizontal spacing of the widest character in the Latin1 character set.
--font=...
Set font family to use. You can either point directly to a font file, as in --font=myfont.ttf, or simply the name "myfont" if that font exists as myfont.ttf or myfont.ttc in the default font search path.

If you want to use a font in your current directory, you must specify it like this: --font=./fontname.ttf

You can also set your own font search path with a comma delimited list in the environment variable GDFONTPATH, if you are using gdlib for rendering.

If you have ghostscript installed, you can do a `which gs' and investigate that path's share/ghostscript/fonts/, e.g. /usr/local/share/ghostscript/fonts/. If you find any ghostscript fonts, you can try using one of them. Check out the file `Fontmap' in that directory for descriptive names for those fonts.

Both Cairo and GD use Freetype as a font subsystem, so you can try some fonts with that distribution. The --font parameter can hence read any fonts that Freetype can handle, so you can try with almost any font formats (including truetype fonts).

If you are using Cairo, then a lot of fonts like "Fixed" are shipped with the installation. In that case, you cannot use GDFONTPATH.

In most cases you will want to use a monospaced font, such as `Courier' or `Courier New'. If you don't have any monospaced font, you can emulate the behaviour by using the option --fixed.

--font-size=...
Set font size. Note that you cannot use pixels or pt here. The size is a floating point value, defaulting to 0.025.
--foreground=...
Set foreground color. The format is the same as for HTML/CSS, i.e. aabbcc, in RGB values. Default is white (ffffff).
--format=...
Set PNG pixel format. Available values are ARGB32 (default), RGB24 and A8 (alpha values, 8 bits per pixel).
--height=...
Set output height in pixels. Default is 480.
--html-input
Unfortunately this is probably not what you are looking for. This program will *not* render HTML pages. Instead, it reads the exact format that is output from the program jp2a using the options `--colors --html-raw' (see http://jp2a.sourceforge.net for more information on jp2a).

This is used to color the characters. For reference, the format is this:

<span style='color:#rrggbb;'>A</span><br/>

The <br/> is used to break lines. No newlines are accepted, and the code to parse this input is extremely bad, so you shouldn't get your hopes up for this one.

--help -h
Print help.
--linespacing=...
Sets amount of extra pixels to add between each line. The default is to add 2 pixels. You can set this to zero, or even negative values.
--no-crop
Do not crop away the unused image areas after rendering the text.
--output=...
Set output filename or a directory to write the files to.
--overwrite
Overwrite existing files. The default is not to overwrite, instead adding a numbered suffix to the filename. That is, if you convert foo.txt you get foo.png the first time you convert. The second time you'll get foo2.png and so on.
--verbose
Print verbose output messages. This is useful when you want to know the cropping dimensions, and when converting multiple files to see their output names.
--width=...
Set output width in pixels. Default is 640.
--version -V
Print program version and exit.
--silent -s
Silent mode; do not print any messages to the console.
--size=WxH
Set output width and height in pixels. Default is 640x480.
--tab=...
Set the number of spaces that tab characters will expand to. Default is 8.

Convert files to 800x600 pixels: a2png --size=800x600 file1 file2

Convert text from standard input: a2png --size=800x600 -

Convert file with yellow background: a2png --background=ffff00 somefile.txt

a2png returns 0 for success and 1 for errors.

Carriage returns do not work correctly; they do not replace the characters they overwrite, so you get garbled output.

The --transparent option does not work with gdlib.

The --bold option does not work with gdlib.

Only Latin1 characters are accepted, although the subsystems do support UTF-8.

Check the web at http://a2png.sourceforge.net for new versions, these issues might very well be fixed in future updates.

Christian Stigen Larsen <csl@sublevel3.org> -- http://csl.sublevel3.org

a2png is distributed under the GNU General Public License v2.
September 22, 2006 version 0.1

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.