Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Common Graphics Formats

Computer graphics are used for Web page design and report documents, and they are also used by engineers, by computer artists (designers or photographers), and even by medical researchers and practitioners. Some graphics development tasks have only modest hardware and software requirements, whereas others, such as floating-point–intensive 3D renderings and raytracings, may require specialized equipment, such as graphics cards with 64MB or more video RAM, large (19'' or larger) monitors, enormous amounts (512MB or more) of RAM, and fast CPUs. This section covers simpler graphics formats for home desktop and small business users.

Table 8.1 lists most of the types of graphics included with Red Hat Linux. You may find some new terms and acronyms, but in general, under Linux as well as other operating systems, graphics files are defined according to format, resolution, and color depth. Whereas black-and-white images are represented by resolution, or the number of pixels (dots) wide and high, and a simple "on" or "off" two-color scheme, color images may vary according to not only resolution, but the number of colors used by the graphics file. Typically, early graphics files used 16, 32, 64, or 256 colors. However, today many graphics images are stored in thousands and millions of colors (although the human eye is said to be able to distinguish only 160,000 distinct colors, many graphics monitors will only display thousands of colors, and most humans can only distinguish 30 levels of gray). Some pixel formats use three bytes of storage to represent red, green, and blue values to represent the color of each pixel of an image.

Note that not all graphics formats in Table 8.1 are pixel-oriented. Some, like PostScript, are based on page description and line drawing, creating vector-based graphics. If you view PostScript graphics in a text editor, such as emacs, you can read the "language" that describes the document. On the other hand, most pixel-based formats are binary only and unreadable.

What does this mean to the user? In general, 2D pixel-based graphics files will require ever-larger amounts of memory and hard drive storage as the resolution and color depth increase. To help stave off these requirements, many formats, such as JPEG and PNG, incorporate compression, or the removal of redundant and unneeded information in the file.

Table 8.1. Common 2D Graphics Formats

Name Description
BMP Windows bitmap
CGM Computer Graphics Metafile
EPS, EPSF Encapsulated PostScript File
GIF Graphics Interchange Format
JPEG Joint Photographic Experts Group
MIFF Magick Image File Format
PBM Portable bitmap
PCX PC Paintbrush
PGM Portable graymap
PNG Portable Network Graphics
PNM Portable anymap
PPM Portable pixmap
RLE Run Length Encoded
TGA Targa File Format
TIFF Tag(ged) Image File Format
XBM X11 bitmap
XPM X11 pixmap
XWD X11 Windows Dump

There are also many types of 3D graphics formats. In the recent past, creating, editing, rendering, or displaying pictures using 3D software required high-end computational resources. Today, you'll find a number of Open Source 3D engines, applications, editors, games, software libraries, modeling clients, and visualization systems available for Linux. However, you'll still need a compliant graphics card and proper X11 driver support for your card in order to use this class of software. One of the best places to look for an index of 3D hardware and software for Linux is http://www.linux3d.org/.

The ability to use advanced modeling and rendering software and hardware is a relatively new development for Linux, but developers and manufacturers are picking up the pace as new software is ported to the Linux platform and new graphics cards are brought to market. Some of these software packages can have enormous resource requirements, so expect only modest performance, even on 450MHz Pentium-class computers, even if you have a capable graphics card! Few, if any, laptop users will be able to take advantage of this class of software and graphics until further advances are made in graphics chipset design, CPU speed, hard drive storage, and memory.

Converting Graphics

Fortunately, most desktop PC users don't need high-end graphics cards, monitors, CPUs, and software to work with graphics. Linux comes with hundreds of simple graphics applications that may be used to create, edit, and translate graphics without the need for loading a large application and windowing client. Many of the graphics commands discussed in this section don't even require a running X11 session!

Table 8.2 lists commands that may be used to read, convert, or save graphics files. Most commands will work from the command line, while others, such as the GIMP (see Using the GIMP later in this chapter) must be run during an X11 session. Most of the commands belong to several distinct "families" from one or more developers:

The convert command is one of the most flexible and useful graphics conversion commands included with Red Hat Linux. This command may be use to translate graphics formats on-the-fly using filename extensions. For example, to convert the graphic kitty.gif from GIF format to PCX format, use the convert command like this:


   # convert kitty.gif kitty.pcx

After you press Enter, the convert command will create a new file in the desired format with name kitty.pcx, leaving the original untouched.

Table 8.2. Linux Graphics Formats and Conversion Programs

Extension Description Conversion Program
.10x Gemini 10X pbmto10x
.3d Red/Blue 3D pixmap ppm3d
.asc ASCII text pbmtoascii
.atk Andrew Toolkit raster atktopbm
    pbmtoatk
.avs AVS X image convert
.bie Bi-level image expert convert
.bg BBN BitGraph graphics pbmtobbnbg
.bmp Windows, OS/2 bitmap bmptoppm
    cjpeg
    convert
    gimp
    ppmtobmp
    xv
.bmp24 Windows 24-bit bitmap convert
    xv
.brush Xerox doodle brush brushtopbm
.cgm Computer graphics metafile convert
.cmu CMU window manager bitmap cmuwmtopbm
    pbmtocmuwm
.dcx ZSoft Paintbrush convert
.ddif DDIF image pnmtoddif
.dib Windows bitmap image convert
.dxb AutoCAD database file ppmtoacad
    sldtoppm
.dvi TeX printer file dvips
    dvilj4
    dvilj4l
    dvilj2p
    dvilj
.eps2 Encapsulated PostScript Level II convert
.epsf Encapsulated PostScript convert
    pixie
.epsi PostScript preview bitmap pbmtoepsi
    convert
.ept Encapsulated PostScript convert
.epson Epson printer graphics pbmtoepson
.fax Group 3 fax convert
.fig TransFig image convert
.fits Flexible Image Transport fitstopnm
    pnmtofits
    convert
    gimp
    xv
.fpx FlashPix convert
.g3 Group 3 fax file g3topbm
    g32pbm
    g3cat
    pbm2g3
    pbmtog3
.gif Graphics Interchange giftopnm
    gif2tiff
    gimp
    xpaint
    ppmtogif
    convert
    xv
.gif87 Graphics Interchange convert
    xv
.go Compressed GraphOn pbmtogo
.gould Gould scanner file gouldtoppm
.icn Sun icon icontopbm
    pbmtoicon
.ico Microsoft icon convert
.ilbm IFF ILBM file ilbmtoppm
    ppmtoilbm
.img GEM image file gemtopbm
    pbmtogem
    imgtoppm
.icr NCSA ICR raster ppmtoicr
.jbig Joint Bi-level Image Group convert
.jpeg Joint Photographic Experts Group cjpeg
    djpeg
    jpegtran
    xpaint
    convert
    gimp
    pixie
    xv
.lj HP LaserJet data pbmtolj
.ln03 DEC LN03+ Sixel output pbmtoln03
.mgr MGR bitmap mgrtopbm
    pbmtomgr
.miff MNG multiple-image network convert
.mitsu Mitsubishi S340-10 file ppmtomitsu
.mpeg Motion Picture Group convert
.mtv MTV ray tracer mtvtoppm
    convert
.pbm Portable bitmap pbm*
    convert
    xv
    pdftopbm
.pcd Photo CD convert
.pcl HP PaintJet PCL ppmtopjxl
    convert
.pcx PCX graphics pcxtoppm
    ppmtopcx
    convert
    gimp
    xv
.pdf Portable Document Format convert
    xpdf
    pdftops
    pdftotext
    pdftopbm
.pgm Portable graymap pbmtopgm
    pgmtoppm
    ppmtopgm
    convert
    cjpeg
    xv
    ee
.pi1 Atari Degas file pi1toppm
    ppmtopi1
.pi3 Atari Degas file pbmtopi3
    pi3topbm
.pict Macintosh PICT file picttoppm
    ppmtopict
    convert
.pj HP PaintJet file pjtoppm
    ppmtopj
.pk PK format font pbmtopk
    pktopbm
.plasma Plasma fractal convert
.plot UNIX plot file pbmtoplot
.png Portable Network Graphic pngtopnm
    pnmtopng
    convert
    gimp
    pixie
    xpaint
    xv
.pnm Portable anymap pnm*
    convert
    gimp
    ee
    pixie
.pnt MacPaint file macptopbm
    pbmtomacp
.ppa HP Printing Architecture pnm2ppa
    pbm2ppa
.ppm Portable pixmap ppm*
    cjpeg
    convert
    xpaint
    xv
    ee
.ps PostScript (lines) pbmtolps
    pnmtops
    convert
    xv
    gimp
    gv
    ee
.psd Abode PhotoShop bitmap convert
.ptx Printronix printer graphics pbmtoptx
.qrt QRT ray tracer qrttoppm
.rad Radiance image convert
.ras Sun rasterfile pnmtorast
    rasttopnm
    gimp
    xv
.rla Alias/Wavefront image convert (read-only)
.rle Utah run-length encoded convert (read-only)
    xv
.sgi Silicon Graphics image pnmtosgi
    sgitopnm
    convert
    gimp
.sir Solitaire graphics pnmtosir
    sirtopnm
.sixel DEC sixel format ppmtosixel
.spc Atari Spectrum file spctoppm
.spu Atari Spectrum file sputoppm
.sun Sun rasterfile convert
    gimp
.tga TrueVision Targa file ppmtotga
    tgatoppm
    convert
    gimp
    xv
.tiff Tagged Image File Format pnmtotiff
    tifftopnm
    tiff2ps
    convert
    gimp
    pixie
    xv
    xpaint
    ee
.tiff24 Tagged Image File Format (24-bit) convert
    xv
.tim PSX TIM convert
.ttf TrueType font file convert
.txt text file bitmap pbmtext
    convert (read-only)
.uil Motif UIL icon ppmtouil
    convert
.upc Universal Product Code pbmupc
.uyvy 16-bit YUV format convert
.vicar   convert (read-only)
    xv
.viff Khoros Visualization image convert
.x10bm X10 bitmap pbmtox10bm
.xbm X11 bitmap pbmtoxbm
    xbmtopbm
    convert
    pixie
    xpaint
    xv
.xim Xim file ximtoppm
.xpm X11 pixmap ppmtoxpm
    xpmtoppm
    convert
    gimp
    pixie
    xpaint
    xv
.xv xv thumbnail xvminitoppm (xv)
.xvpic xv thumbnail file xvpictoppm (xv)
.xwd X11 Window Dump pnmtoxwd
    xwdtopnm
    convert
    gimp
    xpaint
    xv
.ybm Bennet Yee face file pbmtoybm
    ybmtopbm
.yuv Abekas YUV file ppmtoyuv
    yuvtoppm
    convert
.zeiss Zeiss confocal file zeisstopnm
.zinc Zinc bitmap pbmtozinc

Many of the programs listed in Table 8.2 that work with the command line may also use input-output redirection, along with pipes on the command line. For example, if you have a file named foo.pcx in PCX format, but would also like a copy in GIF and TIFF formats, you can combine the output of various commands, such as pcxtoppm, ppmtogif, giftopnm, and pnmtotiff like this:


   # pcxtoppm foo.pcx | ppmtogif | tee foo.gif | giftopnm | pnmtotiff >foo.tif

This command line, which also uses the tee command to siphon off output from the ppmtogif command, creates two copies of the original file, one named foo.gif in GIF format and the other named foo.tif in TIFF format.

Linux also comes with a number of command-line programs that may be used to perform other manipulation tasks, such as cropping, resizing, and flipping horizontally or vertically. See the man pages for the pnmcrop, pnmcut, pnmenlarge, pnmflip, pnminvert, pnmrotate, or pnmscale commands.

Share ThisShare This

Informit Network