Document Conversion
I can never remember the tools or process to convert documents in Linux. My HP OfficeJet all-in-one wireless printer can scan documents, but will only save them as JPG or PNG files. As most document exchanges use PDF, I needed to convert the scanned PNG images to a PDF file.
The tool to do the conversion is called "convert". The tricky part is getting the dimensions right. This first example will convert a 180dpi 24-bit color letter size image to a 120dpi color PDF. Adjust the dimensions after -resize and -density for different size originals and different PDF resolutions as needed. For example, for 150 DPI use 1275x1650 and 150x150 respectively.
$ convert hpscan0001.png -resize 1020x1320 -units PixelsPerInch \
-density 120x120 doc_01.pdf
The following command converts a series of 120 DPI 24-bit color scans (named hpscan001.png, hpscan002, etc.) to a single 120 DPI 256-color
grayscale PDF:
$ convert hpscan*.png -compress zip -colors 256 -colorspace GRAY \
-resize 1020x1320 -density 120x120 -units PixelsPerInch all_docs.pdf
There are other tools available to perform the conversion. Tools to convert PDF and PS (postscript), besides many others are available. Using the command "apropos pdf", and "apropos ps" you can get a reasonable list of those tools. I've listed several image format queries below:
sandholm@beast2:~/scan> apropos pdf
a2ping (1) - convert between PS, EPS and PDF and other page descrip...
dvipdf (1) - Convert TeX DVI file to PDF using ghostscript and dvips
dvipdfm (1) - Produce PDF files directly from DVI files
dvipdft (1) - create thumbnail images for use with dvipdfm
e2pall (1) - convert all EPS files in a LaTeX document to PDF
ebb (1) - extract a bounding box from JPEG, PNG, and PDF files
epstopdf (1) - convert an EPS file to PDF
fdf2tex (1) - Convert PDF formular data (FDF) into something (Con)Te...
gs (1) - Ghostscript (PostScript and PDF language interpreter a...
gsnd (1) - Run ghostscript (PostScript and PDF engine) without di...
pdf2dsc (1) - generate a PostScript page list of a PDF document
pdf2ps (1) - Ghostscript PDF to PostScript translator
pdfeinitex (1) - PDF output from TeX
pdfetex (1) - PDF output from e-TeX
pdfevirtex (1) - PDF output from TeX
pdffonts (1) - Portable Document Format (PDF) font analyzer (version ...
pdfimages (1) - Portable Document Format (PDF) image extractor (versio...
pdfinfo (1) - Portable Document Format (PDF) document information ex...
pdfopt (1) - Ghostscript PDF Optimizer
pdftex (1) - PDF output from TeX
pdftohtml (1) - program to convert pdf files into html, xml and png im...
pdftoppm (1) - Portable Document Format (PDF) to Portable Pixmap (PPM...
pdftops (1) - Portable Document Format (PDF) to PostScript converter...
pdftotext (1) - Portable Document Format (PDF) to text converter (vers...
ps2ascii (1) - Ghostscript translator from PostScript or PDF to ASCII
ps2pdf (1) - Convert PostScript to PDF using ghostscript
ps2pdf12 (1) - Convert PostScript to PDF 1.2 (Acrobat 3-and-later com...
ps2pdf13 (1) - Convert PostScript to PDF 1.3 (Acrobat 4-and-later com...
ps2pdfwr (1) - Convert PostScript to PDF without specifying Compatibi...
snmpdf (1) - display disk space usage on a network entity via SNMP
texi2dvi4a2ps (1) - Compile Texinfo and LaTeX files to DVI or PDF
thumbpdf (1) - generate thumbnail images for a PDF file created with ...
wvPDF (1) - convert msword documents to PDF
sandholm@beast2:~/scan> apropos ps2
eps2eps (1) - Ghostscript PostScript "distiller"
fig2ps2tex (1x) - generate a TeX file for including a PostScript file
ps2ascii (1) - Ghostscript translator from PostScript or PDF to ASCII
ps2eps (1) - convert PostScript to EPS (Encapsulated PostScript) files
ps2epsi (1) - generate conforming Encapsulated PostScript
ps2frag (1) - obsolete shell script for the PSfrag system.
ps2pdf (1) - Convert PostScript to PDF using ghostscript
ps2pdf12 (1) - Convert PostScript to PDF 1.2 (Acrobat 3-and-later compatible) using...
ps2pdf13 (1) - Convert PostScript to PDF 1.3 (Acrobat 4-and-later compatible) using...
ps2pdfwr (1) - Convert PostScript to PDF without specifying CompatibilityLevel, usi...
ps2pk (1) - creates a TeX pkfont from a type1 PostScript font
ps2ps (1) - Ghostscript PostScript "distiller"
sandholm@beast2:~/scan> apropos png
dvipng (1) - A DVI-to-PNG translator
ebb (1) - extract a bounding box from JPEG, PNG, and PDF files
pdftohtml (1) - program to convert pdf files into html, xml and png images
png2yuv (1) - Convert PNG images to the YUV4MPEG stream format.
pngtopnm (1) - convert a PNG image into a PNM image
pnmtopng (1) - convert a PNM image to PNG
Tk::PNG (3pm) - PNG loader for Tk::Photo
xcursorgen (1) - create an X cursor file from a collection of PNG images
sandholm@beast2:~/scan> apropos gif
ppmtogif (1) - convert a PPM image to a GIF image
sandholm@beast2:~/scan> apropos ppm
411toppm (1) - convert Sony Mavica .411 image to PPM lbAC
PPM (5) [ppm] - Netpbm color image format
anytopnm (1) - convert an arbitrary type of image file to PBM, PGM, or PPM
bbox (1) - prints out the bounding box of a rawppm or rawpbm image
bmptoppm (1) - replaced by bmptopnm
eyuvtoppm (1) - convert a Berkeley YUV file to a portable pixmap (ppm) file
fiascotopnm (1) - Convert compressed FIASCO image to PGM, or PPM
gouldtoppm (1) - convert Gould scanner file into a PPM image
hpcdtoppm (1) - convert a Photo-CD image into a PBM image
ilbmtoppm (1) - convert an ILBM file into a PPM image
imgtoppm (1) - convert an Img-whatnot file into a PPM image
jpegtopnm (1) - convert JPEG/JFIF file to PPM or PGM image
leaftoppm (1) - convert Interleaf image format to PPM image
libppm (3) - functions for PPM programs
mtvtoppm (1) - convert output from an MTV or PRT ray tracer into a PPM
neotoppm (1) - convert an Atari Neochrome .neo into a PPM image
pamcut (1) - cut a rectangle out of a PAM, PBM, PGM, or PPM image
pc1toppm (1) - convert an Atari Degas .pc1 into a PPM image
pcdovtoppm (1) - create index image for a photo CD
pcxtoppm (1) - convert a PCX file into a PPM image
pdftoppm (1) - Portable Document Format (PDF) to Portable Pixmap (PPM) converter (v...
pgmtoppm (1) - colorize a PGM (grayscale) image into a PPM (color) image
pi1toppm (1) - convert an Atari Degas .pi1 into a PPM image
picttoppm (1) - convert a Macintosh PICT file to a PPM
pjtoppm (1) - convert an HP PaintJet file to a PPM image
pnmcut (1) - cut a rectangle out of a PBM, PGM, or PPM image
pnmhistmap (1) - draw a histogram for a PGM or PPM file
pnmtorast (1) - convert a PPM into a Sun rasterfile
ppm (5) - Netpbm color image format
ppm3d (1) - convert two PPM images into a red/blue 3d glasses PPM
ppmbrighten (1) - change a PPM image's Saturation and Value
ppmchange (1) - change all pixels of one color to another in a PPM image
ppmcie (1) - draw a CIE color chart as a PPM image
ppmcolormask (1) - produce mask of areas of a certain color in a PPM file
ppmdim (1) - dim a PPM image
ppmdist (1) - simplistic grayscale assignment for machine generated, color images
ppmdither (1) - ordered dither for color images
ppmfade (1) - generate a transition between two image files using special effects
ppmflash (1) - brighten a picture to approach white
ppmforge (1) - fractal forgeries of clouds, planets, and starry skies lbAC
ppmhist (1) - print a histogram of the colors in a PPM image
ppmlabel (1) - add text to a PPM image
ppmmake (1) - create a PPM image of a specified color and dimensions
ppmmix (1) - blend together two PPM images
ppmnorm (1) - replaced by pnmnorm
ppmntsc (1) - Make RGB colors legal for NTSC or PAL color systems.
ppmpat (1) - make a pretty PPM image
ppmquant (1) - quantize the colors in a PPM image down to a specified number
ppmquantall (1) - run ppmquant on a bunch of files all at once, so they share a common...
ppmrainbow (1) - Generate a rainbow
ppmrelief (1) - run a Laplacian relief filter on a PPM image
ppmrough (1) - create PPM image of two colors with a ragged border between them lbAC
ppmshadow (1) - add simulated shadows to a PPM image
ppmshift (1) - shift lines of a PPM image left or right by a random amount
ppmspread (1) - displace a PPM image's pixels by a random amount
ppmsvgalib (1) - display PPM image on Linux console using Svgalib
ppmtoacad (1) - convert PPM to Autocad database or slide
ppmtoarbtxt (1) - generate image in arbitrary text format from PPM image
ppmtobmp (1) - convert a PPM image into a BMP file
ppmtoeyuv (1) - convert a PPM image into a Berkeley YUV file
ppmtogif (1) - convert a PPM image to a GIF image
ppmtoicr (1) - convert a PPM image into NCSA ICR format
ppmtoilbm (1) - convert a PPM image into an ILBM file
ppmtojpeg (1) - replaced by pnmtojpeg
ppmtoleaf (1) - convert PPM image to Interleaf image format
ppmtolj (1) - convert a PPM image to an HP LaserJet PCL 5 Color file
ppmtomap (1) - create a map of all colors in a PPM image
ppmtomd (1) - convert PPM files to the Alps MicroDry printer format
ppmtomitsu (1) - convert a PPM image to a Mitsubishi S340-10 file
ppmtompeg (1) - encode an MPEG-1 bitstream
ppmtoneo (1) - convert a PPM into an Atari Neochrome .neo file
ppmtopcx (1) - convert a PPM image to a PCX file
ppmtopgm (1) - convert a PPM image to a PGM image
ppmtopi1 (1) - convert a PPM image into an Atari Degas .pi1 file
ppmtopict (1) - convert a PPM image to a Macintosh PICT file
ppmtopj (1) - convert a PPM image to an HP PaintJet file
ppmtopjxl (1) - convert a PPM image to an HP PaintJet XL PCL file
ppmtoppm (1) - copy PPM image
ppmtopuzz (1) - convert a PPM image to an X11 'puzzle' file
ppmtorgb3 (1) - separate a PPM image into three PGMs
ppmtosixel (1) - convert a PPM image to DEC sixel format
ppmtoterm (1) - convert a PPM image to a ANSI ISO 6429 ascii image
ppmtotga (1) - replaced by pamtotga
ppmtouil (1) - replaced by pamtouil
ppmtowinicon (1) - convert PPM image into a Windows .ico file
ppmtoxpm (1) - convert a PPM image to an X11 pixmap
ppmtoy4m (1) - Convert PPM images to YUV4MPEG2 stream
ppmtoyuv (1) - convert a PPM image to an Abekas YUV file
ppmtoyuvsplit (1) - convert a PPM image to 3 subsampled raw YUV files
ppmtv (1) - make a PPM image look like taken from an American TV
ppmwheel (1) - make a PPM image of a color wheel
qrttoppm (1) - convert output from the QRT ray tracer to a PPM image
rawtoppm (1) - convert a stream of raw RGB bytes to a PPM image
rgb3toppm (1) - combine three PGM images (R, G, B) into one PPM image
sldtoppm (1) - convert an AutoCAD slide file to a PPM image
spctoppm (1) - convert an Atari compressed Spectrum file to a PPM
sputoppm (1) - convert an Atari uncompressed Spectrum file to a PPM image
tgatoppm (1) - convert TrueVision Targa file to a PPM image
vidtoppm (1) - archived but not working
vidtopppm (1) [vidtoppm] - archived but not working
winicontoppm (1) - convert a Windows .ico image into 1 or more PPM images
ximtoppm (1) - convert an Xim file to a PPM image
xpmtoppm (1) - convert an X11 pixmap to a PPM image
xvminitoppm (1) - convert an XV 'thumbnail' picture to PPM
xvpictoppm (1x) - converts XV 'thumbnail' files to standard PPM format
y4mtoppm (1) - Convert YUV4MPEG2 stream to PPM images
yuvsplittoppm (1) - convert separate Y, U, and V files into a PPM image
yuvtoppm (1) - convert Abekas YUV bytes to PPM