Classic Computer Magazine Archive START VOL. 2 NO. 2 / FALL 1987

PIXEL-PRO
The prismatic pixel processor

by Matt Loveless Consulting Editor


It's here! Pixel-Pro, the amazing new graphics program that lets you twiddle the pixels in your ST pictures! You can't make hundreds of julienne fries with it, but you can turn a beautiful digitized photo into a pixelized Jackson Pollack apparition! Pick a peck of processed pixels with Pixel-Pro, in the file named PIXELPRO.ARC on your START disk!

pixelpro1.jpg

Above is an example of multiple techniques to enhance a digitized photo.

pixelpro2.jpg
Original digitized photo
pixelpro3.jpg
One degree of graininess 5 x 5 chunkiness (used on background only) Four degrees of graininess

"You've invented a new way for me to waste time" -Dr. T Software programmer Tom Jeffries, after trying Pixel-Pro for the first time.

File PIXELPRO.ARC on your START disk.

Image processing is one of those specialized areas in the computer world. There's a certain academic exhilaration attached to it, but in real life--in my life at least--it's about as exciting as watching dough rise. To tell the truth, I don't care about exploring the murky mists of inverse Fourier transforms, convolution kernals, and space invariant filtering. I don't want to reconstruct the Mona Lisa or enhance satellite photographs. I just want great graphics.

I admit it: I have almost zero artistic ability, but give me somebody else's art work and a paint program and I'll stipple, distort and stretch the image to an ugly death. What I needed was a tool that would give me real destructive and manipulative image power.

That's why I created Pixel-Pro, START's Pixel Processor program. You can use it with almost any low-resolution ST picture. It does some of the same things that full-scale image processing systems do--but mostly, it lets you play with your ST pictures.

USING PIXEL-PRO

To use Pixel-Pro, copy the file PIXELPRO.ARC to a fresh disk along with ARCX.TTP. Run ARCX and type in the filename PIXELPRO.ARC, and in a short time the program files will be ready to use.

Pixel-Pro works only with a color monitor. Set your desktop to medium resolution, then double-click on PlXELPRO.PRG. When the program runs, click anywhere in the dialog box to begin. The first thing you'll want to do is load a picture.

Pixel-Pro isn't a drawing program, and it does not create pictures. Instead, it works with low-resolution pictures you've already created with a video digitizer, NEOchrome, DEGAS, or even Flicker, the drawing and animation program from the Summer 1987 issue of START. Your pictures should be in uncompressed form, with the extender .NEO, .PI1, .PI2, or PI3.

To load a picture, drop down the File menu and click on Load NEO or Load DEGAS, then select a picture with the file selector. Once it's loaded, you can view the picture by clicking on View from the File menu. The picture will be displayed for as long as you hold the mouse button down. If you clicked and released quickly on View, the screen may have only flashed momentarily. You must press and hold the button on the View option.

You can save your work at any time by clicking on Save NEO or Save DEGAS on the File menu. It doesn't matter which type of file the original was; you can save it as either. Keep in mind, however, that color cycling and other special features are not saved along with the file.

You can leave Pixel-Pro and return to the desktop at any time by clicking on Quit on the File menu. Be careful, though: you'll get no chance to back out of Quit. The program will exit immediately, and you'll lose any picture that's still in memory.

When you choose an operation from a Pixel-Pro menu, you'll usually find yourself looking at your picture, with a set of mouse-controlled crosshairs on the screen. That means Pixel-Pro wants you to select an area of the picture to work on--a rectangle within which the selected operation will occur.

To select a rectangle, position the crosshair wherever you want one of the corners to start, then press and hold the left mouse button. The cursor will change to an arrow; move the mouse, and you can stretch a box onto the screen. You can abort the box at any time by clicking the right mouse button. You can also leave your picture and return to the GEM screen any time the crosshairs are active--simply click the right mouse button.

pixelpro4.jpg
3 x 3 chunkiness
pixelpro5.jpg
5 x 5 chunkiness Dominate Reverse

A SHORT TUTORIAL ON ST GRAPHICS

In order to understand many of the features of Pixel-Pro, it helps to understand the rudiments of ST graphics. Of course, you don't have to understand how the ST does its thing; if you like, you can just experiment with the program to see what happens. But in case you're interested, we'll cover some of the basics, so you'll understand what's happening.

The Atari ST supports three graphics modes: high-resolution monochrome, medium-resolution color and low-resolution color. Pixel-Pro was designed to work exclusively with low-resolution color pictures (even though you must run the program from a medium resolution desktop). A low-resolution picture is made up of 64,000 dots (called pixels)--320 pixels wide and 200 pixels high--and each dot is one of 16 different colors. You can select which 16 colors it uses (out of 512 possible colors) by specifying the colors in terms of red, green and blue.

Why red, green and blue? Look closely at your ST monitor's picture tube and you'll see that it's coated with three different types of phosphor dots--some are red, some are green and some are blue. The phosphors are grouped into trios--each with one red, one green and one blue phosphor. By varying the intensity of the light that each phosphor gives off, the ST can show different shades of color. If just the red phosphor is on, for example, the trio will show up as a shade of red. If both the red and green phosphors are on full, the trio will appear yellow (remember, light colors add different than paint colors). If red is on full and green is at half intensity, it will look orange.

Since each phosphor has eight different possible intensities with the ST, there are 512 different combinations possible. ST colors are usually described in terms of their RGB content (the amount of Red, Green and Blue). Black, for example, is 000 (no red, no green, and no blue); bright red is 700 (all red, no green, and no blue); and a light grey is 444 (equal proportions of all three colors).

In the ST's low resolution, you can select 16 of those 512 colors to use for your picture, and each pixel in the picture is one of those 16 colors. In other words, out of 512 possible colors you select 16 for your palette, and from those 16 you select one palette color for each pixel. Thus, each pixels color isn't specified as red or green--it's "color number 5" or "color number 13." As a result, you can change your picture without actually changing any pixel information--just change color number 13 from, say, 347 (3 parts red, 4 parts green and 7 part blue) to 730 (7 parts red, 3 parts green and no blue), and any pixel that was set to color number 13 will automatically change.

(In the not-too-distant future, there may be increased resolution and more colors onscreen at once for the STÑ-but for now, that's what we're limited to.)

The 16 colors in any low-resolution ST picture are collectively called the palette and each pixel selects its color {from the palette with a number--0 through 15. In hexadecimal, that's 0 through F--or in binary, 0000 through 1111 (see Table 1).

The special chips in the ST that speed up graphics display read those numbers in binary--in fact, they split each one off into its four bits. Thus, 64,000-pixel low-resolution picture is effectively stored as four 64,000-bit images called bit planes (see Figure 2). For example, a pixel with palette color 13 (binary 1101) is represented in memory by a 1 in bit-plane 0, a 0 in bit-plane 1, 1 in bit-plane 2, and a 1 in bit-plane 3:

Plane 0 holds the value for bit 0 of every pixel, plane 1 holds the value for bit 1 of every pixel, and so on for planes 2 and 3.

Pixel-Pro was originally designed to work with digitized pictures, which usually have a very distinct palette: 8 or 16 shades of one color, ranging from darkest to lightest. However, Pixel-Pro will have interesting effects on any picture. Just keep in mind that the results may not always be predictable.

Now--back to the program!

PALETTE OPERATIONS

The simplest features of Pixel-Pro are the palette operations on the Palette drop-down menu. There are three: RGB Swapping, Tint and Ranges.

RGB Swapping. RGB Swapping allows you to swap the RGB components of the entire color palette. When you select this option, a dialog box comes up. The following swapping options are available:

red <= > green: Swaps red and green components

green <=> blue: Swaps green and blue components

blue <= > red: Swaps blue and red components

TABLE 1
DecimalHexadecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10101010
11111011
12121100
13131101
14141110
15151111

To look at your picture, click and hold on the View icon. The view ability from within dialog boxes differs from the View option on the File menu in that the bottom of the screen is replaced with the color palette, labeled 0 through F (the hexadecimal versions of the numbers from 0 through 15).

When you are done swapping, select either OK or Cancel.

Tint. Tinting allows you to increment or decrement the RGB components of the entire palette. There are two columns of colors, one for adding color and one for subtracting color.

ButtonAffects:
REDred components
GREENgreen components
BLUEblue components
CYANgreen and blue components
YELLOWred and green components
MAGENTAred and blue components
WHITEred, green, and blue components

Ranges. This option allows you to select the type of palette arrangement Pixel-Pro will operate on. The following options are available:

One color 16 shades
Two colors, 8 shades
One color, 14 shades (CAD-3D)
Two colors, 7 shades (CAD-3D)

(Most digitizers use either 8 or 16 shades; the pictures of 3-D objects you create with CAD-3D use either 7 or 14 shades.)

The range information is not used by all of Pixel-Pro's operations, and sometimes it's interesting to choose a range which does not correctly describe your picture.

THE COLORMAP

The Colormap menu has two selections: Edit colormap and Remap. A colormap changes the pixel values of a picture by mapping each possible value (0 through F) to a new value. For example, a null colormap, one that will have no effect, maps all 16 pixel values to themselves. That is, 0 would map to 0, 1 would map to 1, and 2 would map to 2. However, by defining a new colormap, you could map, say, color 0 to color 1, which would change all pixels with a value of 0 into a value of 1. To define a new colormap, use the Edit colormap option; to actually perform a mapping operation, use the Remap option.

Edit colormap. The Edit colormap dialog is fairly complex (see Figure 3). The actual colormap is displayed in the bottom third of the dialog box. Colors from the Source palette are mapped to colors in the Dest palette. When you first load Pixel-Pro, the colormap defaults to a null colormap, where every color is simply mapped to itself. To manually redefine the colormap, drag the desired Source color to the appropriate Destination (rest) color. For example, to swap colors 0 and F, first map color 0 to color F: Point to the box marked 0 in the Source row, drag it to the box marked F in the Dest row, and release the mouse button. The boxes will flash and the Maps To row will be updated to show that color 0 now maps to color F. To complete the swapping operation, drag the Source box F to the Dest box 0. Now if you remap the picture, all pixels that were color 0 will become color F and all pixels that were color F will become color 0.

pixelpro6.jpg
FIGURE 1. ST low-resolution display, illustrating bit planes

You can have three entirely separate colormaps. You select the desired colormap with the bank buttons: Bank 1, Bank 2, and Bank 3. Any remapping operation (including the Edges operation under Effects) uses the colormap that is currency active.

There are also some preset colormaps for some of the more useful mapping operations. Clicking on the Presets button lets you choose from the following:

HI PASSeliminates all but the brighter colors
LO PASSeliminates all but the darker colors
DIMdims the image
BRIGHTENbrightens the image
DEFAULTrestores to a null colormap
NEGATEnegates the image
ALL TO ONEmaps all colors to one specific color

When you select a preset, it replaces the colormap in the current bank. Most of the presets depend on the type of palette you have selected with the Ranges option from the Palette menu. You can also change the ranges from within the Edit Colormap dialog by clicking on the Ranges icon. The presets are not intelligent, so they rely on the range you have selected; they work best with the default palette (16 shades of one color).

You can view the current picture at any time by clicking (and holding) on the View icon. You can leave the dialog by clicking on the Exit button, or remap immediately with the Remap button. If you get confused, click on Help.

pixelpro6.jpg

EFFECTS

The features available from the Effects menu are about as close as Pixel-Pro gets to image processing. Most of the effects are based on a pixel matrix or pixel neighborhood. To understand this, think of every pixel as being surrounded by a matrix of adjacent pixels (see Figure 4). The pixel matrix will likely be either 3x3 or 5x5.

Grainy takes a 3x3 pixel matrix and rotates it onto itself. Pixels are actually picked up and moved within the matrix (see Figure 5). The overall effect is to add a grainy texture to the image. If you use Grainy on the same area nine times, it will rotate back to its original state.

Chunkify takes the center pixel and expands it to a full 3x3 or 5x5 size matrix. As a result, the picture is the same size, but the pixels are much larger. Try following a 5x5 chunkify with a 3x3 chunkify.

Dominate passes over every pixel and looks at the matrix surrounding it. The center pixel is replaced with the dominant color in the neighborhood. If no color dominates, the pixel is left alone. The general effect is that large areas of color get larger and isolated pixels disappear. It's useful to precede a Chunkify with a Dominate.

Edges will modify the edges in an image according to the current colormap; if you haven't modified the default colormap, this will have no effect. You can select three levels of edge sensitivity (high, medium, and low). The sensitivity is based on the proximity of colors according to the Ranges you have selected.

Smooth is my attempt at an ultra-fast antialiaser. Antialiasing blurs an image by using a convolution kernel approximating a Gaussian filter--in simple terms, it removes the jagged edges from diagonal lines. Convolution operations on a full-size image take hundreds of thousands of multiplies and adds, and that's slow. Smooth merely fills corners with carefully selected colors--much faster, although it's not true anti-aliasing.

pixelpro6.jpg
FIGURE 3. Colormap editing screen.

MODES

Preview lets you try an effect without permanently changing the image. Like all items on the Modes menu, you can toggle it on or off by clicking on it.

Planes The four plane options (0-3) and [Reverse All] allow you to choose which bit planes will be affected by the operations. If no planes are selected, operations will have no effect; the default is to have all planes active. You can toggle a plane on or off by clicking on it; you can also reverse the status of every plane by clicking on [Reverse All]. You can achieve some stunning transparency effects by fuming selected planes off. When calculating a pixel, Pixel-Pro takes all planes into account, regardless of the Modes setting; however, it will only modify the planes that are active. That lets you create some striking effects as you process your pictures.

LlFE IN THE COSMOS

If you're interested in exactly how Pixel Pro does its thing, you'll find the source code (written in Megamax C) Antic Online on CompuServe. I think you'll find it interesting to peruse and play with it, but please be judicious: Remember, it's copyrighted source code and may not be reproduced or used commercially without permission.

In any case, the key to getting the most out of Pixel-Pro is experimentation. Collect copies of your favorite low-resolution pictures, load them up and start twiddling those bits. You may find that your ST will never look quite the same again!

Loveless is a free-lance software designer and writer who recently completed the Mega ST documentation for Atari.

PRODUCTS MENTIONED:

CAD-3D 2.0, The Cyber Studio, The Catalog, 544 Second Street, San Francisco, CA 94107, (415) 957-0886, $89.95

DEGAS Elite, Batteries Included, distributed by Electronic Arts, 1820 Gateway Drive San Mateo, CA 94404, (415) 578-0316, $59.95

NEOchrome, Atari Corporation, 1196 Borregas Avenue, PO. Box 61657, Sunnyvale, CA 94088, (408) 745-2000, $39.95

Megamax C, Megamax, Inc., PO. Box 31294, Dallas, TX 75231, (214) 987-4931, $199.95

WHERE TO FIND DIGITIZED PICTURES:

ATARI 16 SIG on CompuServe, 5000 Arlington Centre Blvd., P.O. Box 20212, Columbus, OH 43220, (800) 848-8199, (614) 457-0802 in Ohio and outside the U.S.

ST Roundtable on GEnie, 401 North Washington Street, Rockviile, MD 20850, (800) 638-9636.

DIGITIZERS:

Computereyes Color Video Digitizer, Digital Vision, Inc., 14 Oak Street, Suite #2, Needham, MA 02192, (617) 444-9040, $249.95

Pro-Technik Digitizer, MichTron, 576 South Telegraph, Pontiac, MI 48053, (313) 334-5700, $199.95

WHERE'S THE SOURCE CODE?

You'll find the source code for Pixel-Pro in Antic Online, CompuServe's Atari online magazine. Just log on to CompuServe, then type GO ANTIC and look for the file PIXELPRO in the "What's New" menu. You can download the file, then un-ARC it using ARC (or ARCX.TTP on your START disk).