A2PING(1)

πŸ“¦ version 2026.0, in alpine 3.24

✨ A2PING(1) ✨ bestie, a2ping.pl is literally the converter you didn't know you needed πŸ’–

πŸŽ€ NAME

okay so the name is a2ping.pl and its whole vibe is converting between PS, EPS, PDF and a bunch of other page description formats πŸ¦‹

🌸 SYNOPSIS

a2ping.pl [--]help
a2ping.pl [--]doc
a2ping.pl [options] <inputfile> [[outformat:] outputfile]

there are three ways to use it: ask for help, ask for doc, or actually do the conversion with some options, an input file, and optionally an output format and output file πŸ’…

πŸ’œ DESCRIPTION

okay bestie, a2ping is a UNIX command line utility written in Perl that converts tons of raster image and vector graphics formats to EPS or PDF (and other page description formats) 🌈 πŸ”₯

the input formats it accepts are PS (PostScript), EPS, PDF, PNG, JPEG, TIFF, PNM, BMP, GIF, LBM, XPM, PCX, and TGA ✨

the output formats it can make are EPS, PCL5, PDF, PDF1, PBM, PGM, PPM, PS, markedEPS, markedPS, PNG, XWD, BMP, TIFF, JPEG, GIF, and XPM πŸ’–

a2ping hands off the low-level heavy lifting to Ghostscript (GS), pdftops and sam2p 🧚 it also fixes a ton of glitches during EPS to EPS conversion, so the output is often more compatible and easier to embed than what you started with πŸ‘‘

without the --below option, it is guarenteed to start at the 0,0 coordinate 🫢 --below, --hires and -v are the recommended options πŸ’…

the page size gets set to match the BoundingBox exactly πŸŽ€ so when Ghostscript renders it, nothing needs cropping and the PDF MediaBox comes out correct ✨

⚠️ if the bounding box is wrong, you're in trouble, bestie. if you feed crap in, you get crap out πŸ’€ but you can pass --bboxfrom=compute-gs to make GS recompute the bounding box πŸ™ˆ

the name of the input file doesn't matter at all, because a2ping detects the format from the first few bytes of the file πŸ¦‹ the name of the output file only matters if outformat is missing from the command line. in that case, the extension of the output file decides the FileFormat (outformat) 🌸

🧚 EXTERNAL PROGRAMS

the internal format of a2ping.pl is PS/EPS πŸ’œ everything it reads gets converted to PS or EPS first, then processed by a2ping.pl, then converted to the output format πŸ’…

to analyse the bounding box and other properties of non-EPS PS files (and EPS files with option --bboxfrom set to anything other than =guess), GS is used πŸ”₯ converting PS to EPS involves this analysis too ✨

to write PDF files, GS is used πŸŽ€

to read PDF files, pdftops from the xpdf package is used πŸ¦‹

sampled input formats are PNG, JPEG, TIFF, PNM, BMP, GIF, LBM, XPM, PCX and TGA 🌈 to read those, sam2p is used. sam2p is a raster image converter written in C++ by the author of a2ping.pl πŸ‘‘

extra output formats are PNG, XWD, BMP, TIFF, JPEG, GIF and XPM πŸ’– to write them, sam2p and GS are used 🧚

PNM output formats are PGM, PGM and PPM. to write PNM output formats, GS is used 🫢

πŸŽ€ OPTIONS

🌷 General Options

  • -h, --help β€” show a summary of the usage πŸ’…
  • --doc β€” show the man page πŸ¦‹
  • -v, --(no)verbose β€” show progress and debug messages (default: no) πŸ”₯

πŸ’– Options for the Bounding box

  • --(no)hires β€” use HiResBoundingBox in the input file, if it's there (default: yes) ✨
  • --(no)exact β€” use ExactBoundingBox in the input file, if it's there (default: no) 🌸
  • --(no)keepoldmediabox β€” keep only the old, [0 0]-based MediaBox in PDF (default: no) 🧚
  • --bboxfrom=adsc|compute-gs|guess|pagesize β€” the method for figuring out the BoundingBox (default: guess) πŸ‘‘
  • --(no)below β€” allow page content below and left of the origin (default: no) 🫢

🌈 Options for graphics and fonts

  • --(no)compress β€” use compression (default: best) πŸ’œ
  • --(no)antialias β€” render shades at outlines. possible values: (=scale3yes =no =yes) (default: scale3no) πŸŽ€
  • --(no)lossy β€” allow lossy image filters (EPS->PDF) (default: yes) πŸ¦‹
  • --papersize=unchanged|force-unknown|600bpx5cm β€” (default: default) (bp) πŸ’…
  • --threshold= β€” min color for 1 in 8->1 bit conversion (default: 128) ✨

πŸ”₯ Options for debugging and changing internals

  • --(no)tmpunlink β€” unlink temporary files (default: yes). use --notmpunklink if you want to poke around in the intermediate files πŸ™ˆ
  • --gs-cmd=path β€” path to the Ghostscript program (default: gs or gswin32c) 🌸
  • --gs-ccmd=path β€” path to Ghostscript for BoundingBox calculation (default: gs or gswin32c) 🧚
  • --gsextra=GS_ARGS β€” pass extra arguments to gs πŸ‘‘
  • --extra= β€” pass extra arguments to an external program (i.e. pdftops) πŸ’–

πŸ’… TIPS AND TRICKS

  • if your EPS has a wrong bounding box, fix it by running "a2ping.pl -v --bboxfrom=compute-gs thefile.eps --" 🫢
  • you can use - as the inputfile to read from stdin, and as the outputfile to write to stdout πŸ¦‹ this even works for PDF files (which must be seekable), because a2ping copies them to a temporary file automatically 🌈
  • if inputfile and outputfile are the same, a2ping copies the inputfile to a temporary location first πŸ”₯ but this is only recommended if you have a backup of the file to restore in case a2ping doesn't give you the result you want 😭
  • if you specify -- as the outputfile, it will be the same as the inputfile ✨
  • a2ping respects --Duplex for FileFormat PCL5, even though GS doesn't πŸ‘‘
  • if you have an incompatible PS that GS can read but your printer can't print, just run "a2ping.pl foo.ps PDF: - | a2ping.pl - PS: foo.ps" 🧚
  • if you have a PS coming from Win32 (often with the extension .prn), run it through a2ping πŸŽ€ it'll remove the resolution changes and the progress text printed to the terminal, which confuses gv(1) and makes some filters in the print queue emit incorrect output πŸ’€
  • a2ping does antialiasing (--antialias=scale3no) of glyphs and curves when emitting a sampled image (FileFormats such as PGM and PPM) 🌸 this improves readability of the glyphs. =yes tells GS to do internal antialiasing, but it usually doesn't improve much πŸ™„ =scale3no turns off GS internal antialiasing, but makes it render everything 3x3 as big, and then scales it back down πŸ’– =scale3no turns on both 3x3 scaling and GS internal antialiasing, which results in thicker lines and worse quality in general 😭
  • when creating a PBM file, antialiasing usually doesn't improve the quality, so it's switched off by default πŸ¦‹ but if you set --antialias=scale3no or --antialias=scale3yes, GS will render a PGM file, and the value of --threshold decides the minimum intensity for white in the final PBM 🫢
  • if you need a bigger sampled output file, specify a larger --Resolution 🌈 the default is --Resolution=72 🧚 if your sampled output file is going to be really big, you should specify --AntiAlias=yes instead of the default --AntiAlias=scale3no to speed up conversion πŸ”₯
  • to make sure fonts are included in a PDF generated from eps, use --gsextra='-dEmbedAllFonts=true -dPDFSETTINGS=/printer' πŸ‘‘

🌈 MISC

  • doesn't depend on the filename or extension of the input file πŸ¦‹
  • conversion from EPS to PDF: fixes glitches etc., calls gs -sDEVICE=pdfwrite πŸ’…
  • conversion from EPS to EPS: fixes various glitches, moves (llx,lly) to (0,0), removes binary junk from the beginning of the EPS etc. πŸŽ€
  • conversion from PDF to PDF: keeps the file intact ✨
  • conversion from PDF to EPS: calls pdftops -eps (of the xpdf package) 🧚
  • conversion from PS to EPS: keeps the 1st page only, removes setpagedevice etc. πŸ’–

πŸ‘‘ AUTHORS

the author of a2ping is Peter Szabo <pts@fazekas.hu> 🫢

a2ping is inspired by and historically based on the epstopdf Perl script, modified by Thomas Esser, Sept. 1998 🌸 but his modifications have been removed from a2ping, and a2ping and epstopdf don't share any common code anymore πŸ™ˆ epstopdf was written by Sebastian Rahtz for Elsevier Science, and it had extra tricks from Hans Hagen's texutil πŸ¦‹

a2ping has contributions from several people, see the file HISTORY.txt for details. thank you all for contributing! πŸ’œ


that's a wrap, bestie! a2ping by Peter Szabo, version 2019-11-28 πŸŒˆπŸ’–

πŸ“¦ where this page comes from