ADVANCED SPEED OF LIGHT 3.x Tips and Tricks PART I: Color by Stuart Denman Internet: sdenman@cs.washington.edu (c) Copyright 1994, Stuart Denman. All rights reserved. This is the first in a two part series on how to change and enhance images with Speed of Light Image Processor. I will assume that you have obtained a registered or demonstration shareware copy of at least version 3.3 (version 3.5 is the newest as of this writing.) I will also assume that you have read the manual and understand the basics of Speed of Light (SOL). Since I am the author, I have had many hours of experience using and playing with the program. So as you can imagine, I have come across quite a few interresting ways to change the look of your images. In this first intallment, I will take a look at some of the ways in which you can use SOL's color manipulation techniques to enhance or do really weird things to your image's colors. In part II, I will show you how to physically manipulate your images using filtering (the most confusing, but powerful tool in SOL), warping, and other tools. THE COLOR MANIPULATION TOOLS ============================ Speed of Light has three basic color altering areas, and I will discuss how to make the most of each: 1. Color Selection. This is controlled on the Options Dialog via the color contrast and color selection method (and color rankings). Since SOL stores the original image in memory, you can immediately see a change in these settings without reloading the image. As of version 3.5, you can also specify how colors are selected from truecolor JPEGs as well. 2. Color Transformations. These are also controlled from the Options Dialog. Complex color transformations (histograms) are applied to the colors in the original image before selection occurs. Additive color transformations (the three slider bars that appear when "COMPLEX" is not highlighted) are simply added or subtracted from the colors after color selection occurs. 3. The Color Editor. This dialog allows you to edit individual colors in your image. You can only edit the colors after selection occurs. Once you edit them, you can either have SOL attempt to match the image's colors to the new ones you created, or you can just alter them as they appear in the image without matching. COLOR SELECTION =============== This is the most important section to pay attention to if you have less than a 256 color display (i.e. 16 color Low Resolution ST). I will give values below with the assumption that you have only 16 colors. The better you undertand how SOL reacts to your settings, the better your image will look. I almost always use "Frequency" as a color selection method, so this is what I will focus on. Images vary in what their ideal color contrast value is. To find it, I usually set the three contrast slider bars at around 30 (40 on systems with a palette of only 512 colors.) Then, I make sure that SOL alerts me when it throws out too many colors during selection due to a high contrast (this can be turned on in the Preferences.) Next I display the image. If I get an alert box saying that colors were lost, I reduce the color contrast down to 24 or so. I keep reducing until I no longer get an alert box. This ensures that your colors are spread evenly (as far as their relative contrasts) over the image. This may sound like more trouble than it is worth, but if you really need to have an image look good, this kind of fine user control is the only way to go and is usually better than an automated approach. Next, color contrast settings can be used for spreading out the colors in the image in a more representative manor. In other words, if your image has small areas of blue (shaded from dark blue to light blue) and large areas of red (shaded from dark red to light red), you would want more of your 16 colors used for the shades of red than for blue. To force SOL to select the colors in this way, you would increase the blue color contrast slightly (forcing the blues to be farther apart in brightness) and decrease the red contrast slightly. Using the contrast histograms (by selecting "COMPLEX" above the slider bars) would allow even more fine control by allowing you to set the contrast for each color depending on its intensity of red, green, and blue. COLOR TRANSFORMATIONS ===================== Color transformations can be used both with greyscale and with color modes. In greyscale modes, additive color transformations can be used to add or subtract red, green, and blue from the grey shades. If I want to make a rough change in the images colors, I will often use the additive color settings: -=> To make your image brighter or darker, change the three slider bars to the same value (you can do this by moving one slider bar to the value you want and then double-clicking on that slider to set the other two to the same value). -=> To create a warmer image, increase the red value a little, or darken green and blue. -=> You can also add blue, green, or combinations of the RGB colors to the image to produce weird and interresting effects. The Complex Histogram Transformations are much more interresting. As each color is made up of Red, Green, and Blue (RGB) components, three color transformation histograms are used. Each histogram takes the value of a color and transforms it to a new color. For example, say the color intensities range from 0 to 255. A color with RGB intensities of R 0, G 255, and B 127 fed through a histogram that looked like this: 255 HI|\ | \ | \ | \ 0 LO+---- LO HI 0 255 would produce a new value of R 255, G 0, and B 127. This is because the low values (0) map to the high values (255) and the high values map to the low values. The values in the middle tend to map to themselves (127 to 127). This histogram effectively carries out the calculation Vnew = 255 - Vold. This is known as an inverting histogram, and it can be used for simple, but interresting effects. To get an inverting histogram, edit a color transformation histogram and generate a 1-to-1 histogram. You can do this by loading the file 1_TO_1.HST included with SOL 3.x or create a Gamma preset histogram with a value of 1. Then, Invert or Flip the histogram to get the inverted form. You can also use the red arrow above the three histograms in the Options Dialog to set all of them to 1-to-1, then edit one of them and click on Flip to invert it. Inverting one, some, or all of the RGB histograms can produce some neat effects: -=> The "Green People" effect. Inverting the red histogram makes black into red, and colors with red in them revert to their blue and green components. Since flesh tones are made up of mostly red, inverting just the red will leave green and a little blue left over; hence the "Green People" effect. -=> The "Neon" effect. Inverting the green histogram makes reds into yellows, and dark colors into green, producing a brighter, glowing neon effect. -=> The "Pastel" effect. Inverting the blue histogram produces subtle blues and yellows in the image. -=> If two of the three histograms are inverted (any two) then it produces effects of varying colors similar to the "neon" effect above except that there is more of an inversion in the intensities (dark to light and light to dark.) -=> Inversion of all three produces a "photo negative" effect. This is what is known as a full inversion of the palette. Brightening or darkening the red, green, or blue planes of the color palette can be accomplished with the additive color transformations, but can be more accurately be done using gamma correction histograms. This is done by using Gamma presets with a value greater than 1 for brightening, and less than 1 for darkening. Use a darkening gamma correction on green and blue (leave red at 1-to-1) to produce a warmer image in much the same way as was done with the additive color transformations. Contrast can be applied to single color planes (R, G, or B) to produce interresting results as well. The files CONTRSTx.HST included with SOL 3.x can be loaded in for a varying degree of contrast. Using a contrast histogram on green will bring out the reds, blues, and purples in the darker and lighter colors. This is often a more subtle effect than with using gamma correction. Starting with these simple but interesting effects, you can learn to draw custom histograms that fit your needs. If even more control over your colors is needed, you can move on to the color editor. THE COLOR EDITOR ================ The Color Editor can be used to alter the existing colors in your image, or to create new colors to draw the image from. Changing the existing colors is straight-forward; just pick the color you want to change from the image using "Select" from the color editor, then change it. Make sure "Match" is NOT highlighted so that your changes appear in the image when you display it. Suppose that you are programming a game and you found a cool GIF that would look great as a background. The problem is that the GIF has 256 colors but your game has 16 and you already know what those 16 colors are going to be. Speed of Light can use your color palette to display the GIF in the best way possible. So how do you get your game's palette into SOL? There are two ways: 1) Create the colors by hand using the editor. Be sure to make any unused colors the same as the first color (SOL will not use a duplicate color). Creating them by hand can be a pain because you need to know what all your colors are and where they are located in the palette order. Versions before 3.5 ordered the palette in DEVICE order (see below), but 3.5 allows you to edit the colors in VDI order (this is the same order as the control panel.) Be sure you know what order you are using. XBIOS(7,...) palette setting command sets the colors in DEVICE order, whereas vs_color() sets them in VDI order. 2) Create your own .PAL file using a program. A .PAL file is composed of one byte that tells how many colors are in the file (minus 1), followed by a set of colors defined by 3 bytes each. The first of the three bytes is red, then green, then blue. Another 3 bytes for the next color follows, and so on. SOL loads in however many colors are in the file, starting with color zero. A .PAL file is saved in whatever order the palette was in when you saved it. Depending on your use, you can switch to a different ordering before loading in a palette. The following table shows how to convert from VDI to DEVICE order (although Speed of Light will do all this work for you.) VDI Color 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 DEVICE Color 0 15 1 2 4 6 3 5 7 8 9 10 12 14 11 13 This is for 16 colors. For 256 colors, entries 16-254 are the same for DEVICE as for VDI, but VDI 255 goes to DEVICE 15 and VDI 1 goes to DEVICE 255. Once you have created or loaded in the palette, highlight "Match" so that SOL will try to match the created palette to the GIF. Click on "Display" to show it. Tinker with the settings to get the best picture (add dithering, etc). If you go back to the color editor, you can see the results of SOL's attempts to match the image to your palette. Colors that SOL does not use in the image will be marked with a small X. This means that SOL found other colors that were closer to the original colors than this one. This is just a short example to get you started. I often like to use the "Gradient" tool to create shades of different colors that I think would match the image nicely. I then display it (with "Match" highlighted) and then go back to the Editor. From this point, I can easily change a set of colors to something else, then view the image again with "Match" NOT highlighted to see my changes. Say you have an image of a red car, but you want it blue. Just use the editor to change all the reds to the same intensity of blue, then redisplay the image, making sure "Match" is off. If you leave "Match" highlighted, SOL will try to find those red shades again, but since you changed them to blue, SOL will use some other colors instead and your blue colors will most likely be marked with X's when you return to the Editor. CLOSING REMARKS =============== With some experimenting, you can easily find other color effects that are not obvious at first. SOL provides a lot of tools; the key is to know which ones to use, what your options are, and how the program will react to your settings. I hope this has given you some insite into SOL's color features. Next time, I'll give you some insite into SOL's image manipulation features. Please remember that Speed of Light is Shareware. This means that if you use the program, I request that you send a donation to become a registered user. Your support helps me to produce more quality Atari software like SOL. Complete registration information is included in the SOL manual. The unregistered version of SOL is available online on Genie, Delphi, and Compuserve, as well as many Internet locations including ftp site atari.archive.umich.edu. The filename is SPOFLT35.ZIP. Updates can also be obtained from me (if you are registered) by sending a blank disk and self-addressed stamped envelope. See the manual for complete mailing address. Speed of Light is (c) Copyright 1993, 1994 by Stuart Denman.