Saturday, October 12, 2013

Using Photoshop as a CGA Bitmap Paint Program

Adobe Photoshop has an "indexed color" editing mode for palettized images, but let's admit it, it sucks.  No layers, no anti-aliasing, no filters, no (easy) dithering, and so on so forth: clearly, it's no substitute for DeluxePaint II, Autodesk Animator, or even PC-Paint.  There are modern, free and open source packages which explicitly seek to fill this gap, but just for fun, can Photoshop's limitations be subverted?

Recently, at least by my glacial standards of time, someone (thanks, Andrew!) suggested to me the idea of making a timelapse recording of my pixel-pushing process.  I hadn't done anything like that before, but I did have a fun concept for a blog title along with a matching image, so I decided to give it a go.
The result is obviously plastered all over this blog's header, but here's the video:


The idea was to restrict everything to four CGA colors (the high-intensity "alternate" palette of cyan-red-white) while still working in layered RGB, so I could still have all the amenities at my disposal, unlike the crippled afterthought that is PS's indexed color mode.  I also wanted to simulate intermediate levels by using three 50% dither patterns (black/red, red/cyan, cyan/white) just as if they were solid colors.

After a couple of failed experiments, I stumbled across a convoluted little method that somehow seemed to work: do the actual drawing in greyscale, but slap a series of 7 adjustment layers on top of the whole thing.  Each is triggered by a certain range of grey levels and displays a corresponding CGA color (or dither pattern).

Here's the actual stack of layers; Color Fills for the 4 solid colors, and Pattern Fills for the dither patterns (from Layer -> New Fill Layer, select solid color or pattern respectively).  For each layer, the input range of greys is specified in Layer -> Layer style -> Blending options.  For instance, the pattern layer for alternating black/red pixels is set to blend only when the underlying layer's grey level is between 65 and 67:


The rest of the layers are set up similarly (as you can probably tell by their names), covering the entire 0-255 range.  I gave the "dither" layers much narrower ranges than those of the solid colors - this is just to have finer control over things, otherwise different color pixels can crop up uninvited with things like smooth-edged brushes.  Then I set up a handy "palette" image, so I could quickly color-pick while drawing by holding down Alt and clicking a shade of grey:


So all the actual drawing is done in grey, beneath the fill layers, but as you're drawing, What You See Is What You Get - the state of the art on early '80s IBM PCs and compatibles, 2-bit color pixels in all their glory.
The final drawing...


...actually looks like this "under the hood":


This little trick allowed me to combine several techniques here - pixel-precise mouse work for most of the details and shading, anti-aliased curves for drawing outlines with the Pen tool, importing a scanned pen-on-paper drawing (for the "MPH" part), and using a Wacom pen tablet (for most of the background work).  I daresay it turned out nice... perhaps not quite on Asphyx-levels of awesome, but I have no presumptions.

Because of the extremely limited palette, it pays off to treat the colors as nothing more than their brightness levels: the result can often look good even when you switch to an entirely different set of colors, as long as they have a similar relationship in terms of luminosity.  Of course, this isn't limited to CGA artwork only - the Amstrad CPC has a very similar 4-color video mode, for instance.

This particular method wouldn't work too well with larger palettes however, since the tower of adjustment layers would quickly grow to unwieldy proportions. A program that's actually tailored for this kind of pixel-pushing, such as Grafx2, would obviously be a much better choice (would be nice to get off my ass one of these days and actually learn how to use it).

5 comments:

Bigby Wolf said...

This was very interesting and informative.

mrsid said...

You've essentially re-invented Dan Fessler's method: http://danfessler.com/blog/hd-index-painting-in-photoshop

Anonymous said...

Very interesting! Thx for posting this. I'm planning to do some fun graphics in one of the next parties. This really helps!
-cosmiq/inque

VileR said...

Don't know about 're'-invented (my post does predate his, just for the record); that said, his method seems to be much more versatile, with a bigger bunch of tricks up its sleeve. I'll have to investigate - thanks for the link!

VileR said...

NP! I'm going to post some more info about the trick(s) used in the demo itself, so check back soon in case you're interested.