Troubleshooters.Com Presents

Linux Productivity Magazine

Volume 2 Issue 12, December 2003

Gimp

Copyright (C) 2003 by Steve Litt. All rights reserved. Materials from guest authors copyrighted by them and licensed for perpetual use to Linux Productivity Magazine. All rights reserved to the copyright holder, except for items specifically marked otherwise (certain free software source code, GNU/GPL, etc.). All material herein provided "As-Is". User assumes all risk and responsibility for any outcome.

Have Steve Litt write you a quick application!

See also Troubleshooting Techniques of the Successful Technologist
and Rapid Learning: Secret Weapon of the Successful Technologist
by Steve Litt

[ Troubleshooters.Com | Back Issues |Troubleshooting Professional Magazine ]


 
One picture is worth a thousand words. -- Fred R. Barnard
(3/10/1927 Printers' Ink Magazine, page 114)

CONTENTS

Editor's Desk

By Steve Litt
I happily used Micrografx Windows Draw from 1990 through 2001. Vector based, trivially easy to use yet very powerful, it came with vector clip art sufficient to make almost any cartoon, book cover, web graphic, etc. At lighting speed. I figured I'd use it forever.

But then Richardson Texas based Micrografx sold the program to a company that doesn't market it any more, and I switched to Linux, where it doesn't run, not even with Crossover Office. I needed a new graphics program.

I've heard wonderous praise of dia, xfig, the OpenOffice drawing program, and several others. None could touch the speed, ease and power of Micrografx Windows Draw. Where would I find a suitable vector drawing program? The answer was surprising.

It turns out that a raster graphics program, Gimp, is the best Linux replacement for Micrografx Windows Draw.

Mgx Draw was wonderful because you could independently work with objects, without harming the rest of the drawing. Gimp's layers isolate small pieces of the drawing. Mgx Draw had bezier curves. So does Gimp. Mgx Draw could easily draw ovals, rectangles, etc. So can Gimp.

Gimp falls far short when it comes to clipart. However, if I can retrieve a face off from anywhere, I can put it on a layer, move it around until everything's right, and get it done that way. No, Gimp isn't quite as fast as Mgx Draw, but it's a whole lot faster better than most other graphic programs on Windows and Linux.

And in many areas, Gimp exceeds Mgx Draw. Gimp has rulers, guidelines, zoom, and varying brush sizes so that you can work to the nearest pixel. Gimp has incredibly powerful image processing capabilities, such as the ability to clean up scanned images and brighten up photos.

Most people think of Gimp as powerful but difficult. When viewed from the right mindset, Gimp is incredibly easy. Just think layers. Lots of layers. If you mess up one layer, just redo it.

Most Troubleshooters.Com graphics made after March 2001 were made with Gimp. It's an excellent and highly productive product. It's free software. This issue of Linux Productivity Magazine is devoted to making you a Gimp ninja in an hour or so.

Dig in!

Steve Litt is the author of Samba Unleashed.   Steve can be reached at his email address.

Help Publicize Linux Productivity Magazine

By Steve Litt
Loyal readers, I need your help.

For months I've publicized Linux Productivity Magazine, expanding it from a new magazine to a mainstay read by thousands. There's a limit to what I can do alone, but if you take one minute to help, the possibilities are boundless.

If you like this magazine, please report it to one of the Linux magazines. Tell them the URL, why you like it, and ask them to link to it.

I report it to them, but they don't take it very seriously when an author blows his own horn. When a hundred readers report the magazine, they'll sit up and take notice.

Reporting is simple enough. Just click on one of these links, and report the magazine. It will take less than 5 minutes.

News Mag
Submission URL or Email address
Comments
Slashdot
http://slashdot.org/submit.pl
Just fill in the short form.
LinuxToday
http://linuxtoday.com/contribute.php3
Just fill in the short form.
Linux Weekly News
lwn@lwn.net
Just tell them the URL, why you like it.
NewsForge
webmaster@linux.com
Just tell them the URL, why you like it.
VarLinux
http://www.varlinux.org/vlox/html/modules/news/submit.php
Just fill in the short form.
LinuxInsider.Com,
Newsfactor Network
http://www.newsfactor.com/perl/contact_form.pl?to=contact
Just tell them the URL, why you like it.
The Linux Knowledge Portal
webmaster@linux-knowledge-portal.org
Just tell them the URL, why you like it.
OS News
http://www.osnews.com/submit.php
Just tell them the URL, why you like it.
DesktopLinux
http://www.desktoplinux.com/cgi-bin/news_post.cgi
Only for LPM issues involving the Linux desktop, not for programming or server issues.

If you really like this magazine, please take 5 minutes to help bring it to a wider audience. Submit it to one of the preceding sites.
Steve Litt is the author of Samba Unleashed.   Steve can be reached at his email address.

Gimp Does it All

By Steve Litt
If I were stranded on a desert island with only one graphical tool, I pray it would be Gimp. Gimp might not be easiest for specific applications, but it can do just about anything. This article gives an overview of a select few of Gimp's abilities. Gimp has MANY more abilities than discussed in this article.

Scanned Doc Cleanup

You scan a document from Gimp with File->Acquire->XSane as follows:
How to acquire a scan

Manipulate the XSane histogram so that you get all the colors in all their intensities, but nothing more. The following is an example of an optimally scanned yellow receipt scanned at 75 dpi for reduced web bandwidth:
Originally scanned yellow receipt

The preceding is reasonably readable even though it's taken at very low resolution (75dpi). Normally you'd go at least 150dpi to back up paperwork, but on the web 75 is quite sufficient, because some of you still use dialup.

Speaking of bandwidth, the RGB or indexing of the preceding consumes way too much disk space. You want to get this image down to grayscale. The only problem is, if you simply grayscale it as-is, the human eye has a much harder time distinguishing between print and background:
grayscale receipt

The solution is to first enhance the contrast and brightness, followed up with a select-by-color clear to convert the background to white while still leaving the print and its antialiasing intact. Step 1 is to enhance the brightness and contrast of the grayscale image with Rightclick->image->colors->levels. Here is the histogram shown on the levels screen:
Histogram before tweaking

In the preceding, most of the coloration falls in about half the band, while the rest is nothing but outliers. To get the most intensity variation, pull the limits in to the areas of concentration. That makes the contrast what it should be. Then move middle arrow to the point where it gives the best brightness. In my case, I didn't mess with the middle arrow because I can always change the brightness later -- the contrast is what's important at this point. Watch the image as you adjust. When everything's optimal, click the OK button. The following is the histogram after tweaking the limits. Note that the only thing that changed are the outer arrows immediately below the histogram:
Histogram after tweaking

The preceding contrast tweak yields the following improvement in the image:
Grayscale after contrast adjust

The preceding is readable, but we can do even better by whitening the background while leaving the printing and its associated antialiasing alone. To accomplish this, we use the select by color feature to select the background grays, and then clear them. The trick is to get the background, but leave the print and the antialiasing intact. This is best accomplished with a narrow fuzziness threshold on a moderately dark part of the background, but that dark part must be lighter than the lightest print. Here's the procedure:
The result of the preceding looks something like this:
After the first color selection

The preceding is very readable, although the dark splotches are somewhat distracting. For most purposes, this is sufficient. Notice that all remaining splotches are darker than the gray shade you clicked on, meaning that clicking on them will hurt the print or antialiasing, making it less readable. Further cleanup will require selective work on specific parts of the image:
The following graphic shows after the hand clearing of the smudges and the staple mark above the vendor name and address, the spots in the customer name area, and the splotches running down the lower left side of the receipt:
After hand clearing
The final step is hand selecting the darker text, and within those selections only, using the select by color method to clear the surrounding gray without harming the antialiasing -- a tricky proposition:
After hand color selecting
In the preceding, I had selected and then selected by color within those selections, clearing the color selections. Speficially, I did this to the ORANGE CYCLE at the top, and the word EDGEWATER and the zip code on the second line. You've probably also noticed that this might have made it less readable. When cutting it this fine, extreme care must be used. It's often better not to hand color select.

The following screenshot shows the select by color properties screen.

by color selection screen

Note that these techniques are much more effective at higher scanning resolutions. At 150dpi it would have been much less pixelated and more readable, and even the hand color selections would have been beneficial. At 300dpi you can get some very readable sheets and still store them as grayscale.

Filling in Pdf

This is covered elsewhere on Troubleshooters.Com, so there's no need to repeat the techniques here. Suffice it to say that Gimp provides you with an effective way to take an existing .pdf file, and "write over" it. The image quality will suffer to some degree, but it's a way of getting the job done without paying for Adobe Acrobat and performing licensing audits on it.

Web Graphics

Web graphics are quick drawings made primarily from geometric figures and bezier curves. They're easiest done in top notch vector drawing programs, but Gimp can do an excellent job in a pinch. The trick is to use a separate layer for each drawing element so that if you make a mistake only that layer need be redone. This is very similar to the object philosophy of vector drawing programs.

The other precaution you need to take in Gimp is to size everything right the first time, because it's difficult or impossible to correctly resize parts of a drawing. Vectors are made to resize without jaggies -- raster graphics are not. Perhaps it's best to draw a large drawing first, and if necessary shrink it to 1/2, or 1/3, or 1/4 of the original size using the Rightclick->Image->ScaleImage technique. What you don't want to do is blow up an existing image, because if you blow it up by a factor of 2, 1 pixel becomes 4, and the picture is grainy. Blowing it up or shrinking it by a non-multiple will likely lead to ugliness, so keep it to integer factors or denominators.

An example of a simple web graphic is given later in this document, in the Exercise: Creating a Web Graphic article.

Photo Retouch

There are 2 kinds of photo retouch:
  1. Lighting correction
  2. Modifying the actual image
Lighting correction is easy enough. We've already discussed using the histogram at Rightclick->Image->Colors->Levels to adjust brightness and contrast. In a color picture it can even be used to make skin tones more natural.

Then there's changing what's really there. Who's this handsome devil:
Why, it's me, in my high school yearbook the year I graduated. But where are the zits? My complexion wasn't bad, but it wasn't flawless either. The photographer airbrushed out my zits. Some of my classmates had serious complexion issues, but thanks to that photographer today they can look at their yearbook pictures and see the good looks lying underneath that temporary teenage problem.
Steve Litt's high school graduation yearbook picture

I once used Gimp remove a huge printer, a paper shredder, and a curtain from a picture of our booth at CTS. Here was the original (reduced for bandwidth considerations):
The picture to the right is the original booth picture. Note the printer and paper shredder in the booth on our right, and the curtain in the booth in the camera's foreground clutter the picture and make it less effective.
The picture to the right is the picture after I cropped it, removed the printer and shredder, and the curtain in the foreground. If you look VERY carefully you can see repeating fold patterns on the curtain where the printer and shredder used to be. I copied parts of the curtain over the areas formerly covered by the printer and scanner. I also copied parts of the blue rug over the area formerly covered by the shredder.

I performed similar carpet copying on the curtain in the left foreground, as well as restoring the pant leg and shoe of the man in the bluejeans and blue shirt.

The result of my photo retouch is a much less cluttered photo, where your eye is attracted specifically to our booth. In hindsight, I should have removed the table appearing in the lower right. That would have removed any evidence of our next door neighbors, it would have further focused attention on our booth. Removing the bottom right table would have been a simple matter of continuing the red/blue carpet line, and copying textures to the proper areas. It would have been MUCH easier than the curtains.

Finally, I submit without comment, an original and Gimp-altered picture of myself and the dog I had as a kid:
A boy and his dog
Boy and dog discuss areas of common interest

Quick Riffs

By Steve Litt
You draw some things over and over. This article tells you the fast way to do so.

Using Rulers

If your name is Van Gogh or Van Rijn (Rembrandt to your friends), perhaps you can draw everything freehand. For the rest of us, Gimp has included rulers. The beauty of Gimp's rulers is that they show the current pointer location, so you can align and drag with precision. Better yet, because Gimp scrolls with the dragged pointer, you can set the magnification as high as you want. Observe the following perfectly proportioned 3/4/5 right triangle as it is built:
To the right is the starting point. The mouse pointer isn't visible because this is a screenshot, but notice the arrow at the 5 pixel mark on the top ruler and the arrow at the 30 pixel mark on the left ruler. That's where the pointer was, and where we start the triangle.
Starting point of triangle
Here we've drawn a horizontal straight line. First a point was made at the starting point, and then the Shift button was held while the mouse was moved to x=5, y=10, at which time the mouse was clicked to make the line. 40-10 is 30 -- the 3 side of a 3/4/5 triangle.
After drawing the 30 pixel vertical line
Next we press the Shift button again, and move the mouse pointer to x=45, y=5, then click to create a horizontal line 40 pixels long, the 4 side of the 3/4/5 triangle.
After drawing the horizontal line
Finally, we press the Shift button, move the mouse back to x-5, y=40, and click in order to draw the hypotinuse and complete the 3/4/5 right triangle.

We owe our precision to the use of the rulers, and the fact that the arrows on the rulers tell our precise mouse pointer location. In real life we would have increased the magnification to do this work. Even if the entire figure spanned more than the window we're working in, it's OK, because the window would have scrolled.
After drawing the hypotinuse



Using Layers

Without layers, Gimp would be a toy, and a frustrating one at that. If you've ever used Microsoft Paint you know what I mean. When your drawing reaches a certain level of complexity, the slightest mistake must be extensively reworked.

Layers bring immense power to Gimp. By placing individual picture components on their own layers, you ensure that you never irretrievably overwrite anything, and if you need to erase something, you don't erase the things the appear over or under it.

You create a new layer with Rightclick->Layers->Layers_Channels_&_Paths. This brings up a dialog box that looks like this:
Layer dialog box

Clicking on any of the eyeballs to the left of a layer makes that layer invisible, and the eyeball disappears. To restore the layer to visibility, click where the eyeball had been, and the eyeball reappears and the layer once again is visible.

Clicking the new button () creates a new layer. Clicking the duplicate button () duplicates the currently highlighted layer. The up and down buttons (, ) send the layer toward the front or toward the back, respectively. To delete a layer, highlight it and click the delete button ().

To draw on a particular layer, select that layer in the layer dialog box. Be careful -- sometimes oversights lead to you're drawing on a different layer than that intended.

If you want to make the background layer transparent, or any layer for that matter, simply highlight the layer on the dialog, right click it on the dialog, and choose "Add alpha channel". From that point on, clearing any material on that layer leaves a transparency such that items on lower layers become visible.

Construction Lines

Remember 10th grade geometry? In order to draw various geometric items, you used construction lines, which are light lines serving as guides. Later, when you studied drafting, you once again used construction lines. Construction lines are vital in Gimp, because they allow you to place things exactly. In Gimp, construction lines are limited to horizontal and vertical lines, which is just fine with me. To place a horizontal construction line, click the top (horizontal) ruler, then drag down to the appropriate place. To place a vertical construction line, click the left (vertical) ruler and drag right to the desired location.

Construction lines are dotted lines visible throughout all layers. They are not printed, and are not visible in any saved format, EXCEPT IN GIMP. Gimp saves the construction lines as part of the XML format of the .xcf fileformat.

To move a construction line, click and drag it. To delete a construction line, click and drag it to the ruler.

Notice the spacing slider. This is for drawing dotted lines. Try picking a brush size, and then slide the slider to 1000. Draw, and you'll see a dotted line. This becomes more important when you learn how to draw a straight line.

Line Widths

The width of things drawn by all drawing tools, as well as Rightclick->Edit->Stroke are defined by Gimp's "Brush width". To access and change the brush width, do this:
1x1 is for fine lines, but is not very visible in web graphics. 3x3 is better for tiny web graphics, with the larger sizes even better when precision isn't needed.

Lines

There are 2 kinds of lines -- straight and nonstraight. Nonstraight lines can be drawn freehand with the pencil tool () and various other paintbrushes and the like, or drawn curve by curve using the Bezier curve tool (). Straight lines are drawn with the pencil tool as follows:

The endpoint becomes the startpoint for any subsequent lines, so to draw a subsequent line, just keep pressing the shift key, move the mouse to the next endpoint, and click.

Rectangles

Most graphics programs have specific tools for rectangles. Gimp doesn't, instead relying on the rectangular selection tool. Once you've selected a rectangular region, you can go ahead and either draw a line around it, fill it, or both.

Drawing a Hollow Rectangle

Drawing a Filled Rectangle with no Border

Drawing a Filled Rectangle with a Border

Presumably you want the border a different color than the fill. Otherwise you'd just make a wider filled rectangle without a border.
WARNING: Order counts. If you make the border first, the fill covers the inner half of the border, which probably isn't what you want.

Square

A square is just a special case of a rectangle. To create a square selection, start drawing a rectangular selection, but while you're dragging, depress the keyboard shift key. The rectangle will become square, and any further dragging will shrink or grow, but will stay constrained to a square as long as the shift key is depressed. Do not press the shift key before starting to drag, or the new square will be added to any existing selection, which probably isn't what you want.

Once your square selection is created, you can create filled, bordered, or combination squares exactly like you would with a rectangle.

Ovals and Circles

Creating ovals is exactly the same as rectangles, except you use the oval selection tool (Oval select tool).

Creating a circle is similar to a square. After starting to drag the oval, depress the shift key and continue dragging. The oval changes to a circle, and then as you drag further, it stays constrained to a circle.

2 Ways to Start an Oval

Normally, when you drag a circular selection, the starting point is a right angle tangent to the oval's sides. For instance, if you know where you want the top and left extremes of the oval, you can place construction lines at the intended top and left extremes of the oval, and start the oval at their intersection. The following sequence shows the method:
Starting to draw the oval
Dragging the oval
Finished oval selection
Starting the oval selection
Continuing to drag
The finished oval selection

But sometimes you want to start the oval at its center. Certainly, if you're drawing a bicycle, you'll want to center its wheel at the bottom of the fork. To start at the center, do the following:
Warning: Order is significant. If you press the Ctrl key first, it might still work, but if there was a previous selection, the two selections will be subtracted. Also, pressing the Ctrl key first precludes the ability to create a circular selection -- the attempt will disappear when you release the mouse.

Starting a Circle at the Center

This is not obvious, but once you know how, it's easy.

Irregular Selections

You can create irregular selections with the Bezier tool (), the hand select tool (), the select contiguous tool (), and the Rightclick->Select->Select_by_color functionality.

In my opinion, the hand select tool isn't useful because few people have hands steady enough to hand select accurately.

The select contiguous tool is quick and handy because when you use it and click on a part of an image, it  selects everything of the same or similar color to the pixel clicked, as long as the same or similarly colored pixels are contiguous. Try it and you'll see. You might wonder how similar is considered similar. That's up to you. Doubleclick the select contiguous tool and you'll see a Threshold slider. If set to zero, only exactly matching colors are selected. If set to 255, all non-transparent colors are selected. Experiment with this tool.

What if you want to select certain colors, whether or not they're contiguous to each other. In that case, use the Rightclick->Select->Select_by_color functionality. That series of keystrokes brings up a dialog box where you can change the fuzziness threshold, and define how any existing selection is modified. You can add, subtract from or replace the current selection, or you can intersect with it. The intersection is particularly handy because it gives you a way to constrain your select by color to a certain area. This is ideal for cleaning up dirty scans.'

I've saved the best for last. The Bezier tool gives you the ability to "connect the dots" to form a selection. Better yet, if you drag the dots, it drags the curve points associated with the dots. Still better, if you Ctrl+drag the dots, it moves the dots itself. But wait -- there's more. If you Shift+drag the curve points, it moves only that curve point, creating discontinuous curves for angles and cusps.

Working with Selections

The following is a pretty good summary of simple selection operations:

Task
Method
Shortcut
Clearing
Rightclick->Edit->Clear
Ctrl+K
Filling with foreground color
Rightclick->Edit->Fill with FG color
Ctrl+,
Filling with backround color
Rightclick->Edit->Fill with BG color Ctrl+.
Copying the contents
Rightclick->Edit->Copy
Ctrl+C
Cutting the contents
Rightclick->Edit->Cut
Ctrl+X
Pasting
Rightclick->Edit->paste
Ctrl+V
Move the contents
Drag the selection

Move the selection itself,
not the contents
Alt+drag the selection


Compound Selections

You can add to selections or subtract from selections, thus growing and shrinking them, or making them other than rectangular or elliptical. Selections needn't be contiguous.

To add selections, create a selection, then press the shift key and create a second. The two are added. If they join at any point, it becomes one selection area. If not, it becomes two selection areas, but the distinction is not meaningful, because any action taken on one will be taken on the other.

To subtract selections, press the Ctrl key while drawing the selection to be subtracted. Any area of overlap is deleted from the original selection. Any area of the new selection not overlapping the old is ignored.

Note that when pressing the Shift or Ctrl keys while a selection tool is active places a tiny plus or minus sign by the mouse pointer.

It's important to remember that Shift and Ctrl do double duty in selections. Shift makes rectangles square, and Ctrl makes selection grow around the center. To add and subtract selections without these additional properties, release the Shift or Ctrl key after dragging a little bit. Once again, order is important. To add or subtract, press Shift or Ctrl first, then drag the selection. To select squares or select around a center, drag first, then press the Shift or Ctrl key.

One vitally important compound selection method is Rightclick->Select->Select_by_color. Let's say you want to change your white background to a blue background. You can't do it with the bucket tool (), because you'd need to click into every enclosed area of white. If there's much printing, that quickly becomes prohibitive. Instead, use the select by color functionality.

Selection Tricks for Impressing the Masses

If you doubleclick any tool on the Gimp toolbox, you're presented with a dialog box concerning the tool. The dialog boxes for all the selection tools contain a checkbox called "Feathering", which, when checked, enables a slider. The farther left you slide the slider, the more pronouncedly fill operations are blended with the existing background. Let's use that to make a blue sphere.

Step 1 is to make the sphere by filling a 240 pixel diameter circle with #000099:
Filled circle

That's nice, but it's a circle, not a sphere. Let's put a reflection in the upper right part of the sphere. Change the foreground color to #0000FF. Then doubleclick the circular selection tool, check the Feather checkbox, and set the Radius slider to 50. Now create a 48 pixel circular selection in the upper left, then Rightclick->Edit->Fill_with_FG_color:
After first highlight

Now we'll make an even lighter highlight inside this one. Set the foreground color to #9999FF. Rightclick->Select->Shrink, and shrink by 12 pixels, which is half the current radius. This shrinks the circular selection, but keeps the center in the same place. Now Rightclick->Edit->Fill_with_FG_color:

After 2nd concentric highlight

Now set the foreground white (#FFFFFF), shrink the selection by 6 pixels (half the current), and again fill with foreground:

After final, white highlight

Cropping properly, here's the resulting sphere:

Finished ball
Note that the addition of the highlight gives the ball dimension.

Filling Without Selections

We've already discussed various ways to fill a selection. Occasionally you want to fill without a selection. To do that use the bucket tool (). Sometimes the bucket tool's fills everything within the current layer or selection, whichever is smaller. That's not what you want. You want to fill everything within a contiguous area of similar color. If this happens to you you can change its behavior. Doubleclick the bucket tool to produce its dialog box:
Bucket tool dialog box

Click the Sample Merged checkbox, and it the bucket fills contiguous similarly colored areas. To define how similar is "similar", move the Threshold slider.

Annotating 

This is simple. When annotating any figure, create a layer for the text. Sometimes you might want two layers. For instance, if you're creating a street map, you might want one layer for names of north-south streets, and another for east-west streets. That way the street text won't overwrite other street text.

Scanning Tips

By Steve Litt
Gimp is the ideal front end for scanning. Once your Sane compatible scanner is hooked up and running, install xsane-gimp. Consult your distribution for details.

Now you're ready to scan. From the Gimp toolbox, File->Acquire->XSane:'dev'usb'scanner0. Your scanner might have a different name, but you get the idea.

Starting a scan from Gimp

Now you're brought to XSane. Set the color and DPI to your desired. Be sure to enable the preview mode, take a preview shot, crop to the area of interest, then tweak the histogram to include only colors and intensities existing in the photo. By including only those colors and intensities, you can vary the contrast over every bit of every byte of your color depth. The resulting scan goes right into Gimp for editing.

We've already discussed fixing up scans and materially altering images, so let's discuss one last bastion of photographs: brightening and cleaning up. Note that this applies not only to scanned photos but also to digital photos downloaded directly to your computer.

Brightening a Photo

Few of us are professional photographers using professional equipment, so most of our photos are too bright, too dark, or washed out (not enough contrast). Fortunately Gimp can help. Using the histogram techniques you used in article Gimp Does it All, bring the input level pointers in to exclude areas with little or no color and intensity representation. This dramatically increases your contrast without making things too black and white. Then move the middle pointer to adjust the brightness.

Gimp for Photo Forensics

Remember the picture of my dog and me?
Boy and dog

What's in that room behind my dog and me? Let's find out..

The first step is to crop out everything besides that room (but not deleting any of the room). Use the Bezier select to select out myself, the dog, and everything foreground of that room. Next, I use the Bezier select to select everything in the room, but not boy, dog or walls. I first selected around the whole dog, then between her legs. With each selection, I chose Rightclick->Image->Colors->Levels and brought the outer arrows in line with the intensity limits. As a last step, I doubled the size of the drawing for better display on this website. Here's the result:
The rear room revealed

Several things are now clear. There's a piece of furniture, probably light colored, behind my shoulder. In fact, I recognize it as an all-in-one console audio/television unit my parents bought before I was born. Something tall and square or cylindrical rests atop that unit. There's a window with drapes behind the dog. The window is open, so this must have been taken in the summer. Or maybe not... The window is completely dark, so it must have been taken at night. There appears to be a plant behind my dog's rear end, although I don't remember such a plant from my childhood.

What I've done is selected only the dark areas for enhancement, and because these dark areas had a very narrow range of intensities, I was able to spread that narrow band across all 255 levels of grayscale color, thereby significantly enhancing them.

Would it be possible to peer out the window? Let's try. I rectangularly select the window, then intersect select by color, 15% fuzziness threshold, to select the glass parts of the window, which are the darkest parts, then use the levels histogram to enhance contrast, and blow it up by a factor of 2 (any more pixelates beyond recognition). Here's the result, suitably cropped:

I've used this technique to reveal important people stuck in the background of a flash photo, and to reveal almost hidden writing on signs. On one Troubleshooting Professional Magazine photo, I used it to enhance a flipchart with a blank sheet covering a sheet with writing, such that the writing showed through. I doubt this was visible to the naked eye, but through the technology of Gimp I was able to capture it.
Enhanced at the window

Is it my imagination, or is that a Christmas tree in the window? Could it be a reflection of our Christmas tree? Or could it be the neighbors' Christmas tree? As I remember, you could see in the neighbors' window through our window.

I rescanned the photo at 1200, scanning just the window and its surroundings, adjusting contrast and brightness with the sole purpose of  seeing out the window. Here's the result:
After enhancing the window
The big lump covering the bottom left is my dog's rear end. Everything else is the window and dressings. Only the window panes have been super-enhanced. Well -- it's not Christmas. It's obviously not a reflection of our Christmas tree, and there's no window frame from the neightbors' house. What it looks like is fairly dense bushes, and maybe trees, between our house and the neighbor's. One can't be sure, because at this enhancement level there are plenty of artifacts. For instance, observe the point of light at the upper right of the left most vertical pane, and note the line proceding left throughout the whole leftmost vertical pane, and extending onto the curtain itself. It looks like a tree branch, but trees don't go through glass. There are many specs of light. Are they reflected moonlight? Probably not -- things are lighter toward the right (which corresponds to the front of the house). Perhaps there was a street light illuminating the bushes. As far as all the specs of light, perhaps they are gaps through the bushes where light got through. I just don't know.

Remember that plant I saw in the picture of the room. In this window picture, that plant is almost certainly not there. What is there is some sort of shadow, perhaps from another window with light shining through other bushes.

The point is this. I took a 30 year old black and white photo taken with a Brownie Hawkeye box camera, stored in dusty circumstances for years, bent, curled, and exposed to polution, and made a reasonable deduction of what was out the window in a photo whose subject was not the window, nor the dark room containing the window, but the dog and boy in front of the room. I know the television guys from CSI could do this, but who'd have thought that a guy with Gimp could do this type of investigation?

Exercise: Creating a Web Graphic

By Steve Litt
This is the web header graphic from the original Troubleshooters.Com in July 1996:
Original T.C graphic

It was created in Paintshop Pro 3. There are some extra pixels on the extreme right, but the visible part is 610x110 pixels. Note the "jaggies" in the printing. We'll try to do better by antialiasing. Likewise, the gradient between violetish blue and light tangerine blue occurs in distinct lines. Although this produces the tiniest files, we'll also show you how to create a much smoother gradient. In this exercise we'll duplicate this graphic in Gimp.

The first step is to run Gimp, and create a new RGB file whose dimensions are 610x110. Next, create a layer called Border. On that layer, create a 14 pixel wide rectangular selection at each border, and fill each selection with the border color, which is #008000. Save as tc.xcf, and it should look like this:
With raw border
Next, create a layer called BorderDecorations. This border will contain the highlights and lowlights creating the 3D effects of the border, in effect making it like you're looking out a window at the mountains. What we'll do is measure various decorations on the original, and dupicate them on the BorderDecorations layer, which will go above the Border layer. Let's start with the easiest stuff. On top and to the left is a lighter area that is 4 pixels wide. We know it's 4 pixels wide because we can make a selection, and while we're dragging the selections we can see the selection dimensions in the lower left. Here's a screenshot showing what I mean:
Screenshot of measuring with selection

Using the eyedropper tool on the lighter left and top borders of original, we find out that its color is #00c000, 4 pixels each, so using rectangular selections and fill we place those on the BorderDecorations layer. Here's the result:
Light top and left border decorations

Next, put the black border decorations on the same layer, at the bottom and right, 4 pixels wide:
Black underborders

Notice that the black overwrites the light green, instead of them feathering in on each other. Set a brush width of 1 pixel and mitre the corners by creating triangles with the Bezier tool:

Mitred corners

Now create the 2 pixel inside decorations: Black on the left and top, white on the right, and #68c800 on the bottom:
With inside border decorations

At this point you're done with the Border and BorderDecorations layers. Your next layer will house the gradient in the sky. It's a slightly violet blue on top, and an almost tangerine blue on the bottom. Create a layer called Gradient below the Border layer.

The first step is to get the colors at the extremes of the gradient. Using the eyedropper tool on the original, we see that the top is #b5deff, while the bottom is #f7f7f7.

Create a selection that does not include the border pixels, because you want your entire gradient to occur only in the visible area. Doubleclick the gradient tool (The gradient tool) (also called the Blend Tool). That brings up the properties for the gradient tool:
Gradient properties (blend tool) screen

Notice that the blend is foreground to background. This is important, because it determines which way we drag the tool.

Close the tool options screen. Now singleclick the blend tool (gradient tool) (The gradient tool). Now, on the Gradient layer, place the cursor approximately in the center of the selection, at the very top. Now Ctrl+Drag down to the very bottom of the selection. Release the mouse and your gradient appears, as shown following:

With gradient

Now create a layer called "Mountains", above the "Gradient" layer. You'll put the mountains on this layer. To save time, just download and save the following graphic:
Graphic of mountains

Open the preceding graphic in Gimp, Edit->Copy, and then paste it onto the Mountains layer of the graphic you're creating. Move it so it butts up against the bottom inside border, and the left inside border. The result should look like this:
With mountains

Now you need the writing. To prevent a trademark violation (Troubleshooters.Com is now trademarked), we'll call this MyDomain.Cxm. Create a new layer, above the Mountains layer, called "Text".

Remember how jaggy the original writing was? We're going to do better by putting the writing on a layer whose color is the average color of the gradient. In order to find the average color of the gradient, click with the color picker tool (eyedropper) about half way between the top of the sky and the bottom of the sky on the Gradient layer. This approximates the average color. Just so we're on the same page, make it #d3e9fb.

Now go to the Text layer and fill the whole layer with that color. Make sure that the gradient now looks like a uniform color. Next, make the background color that color (#d3e9fb), and the foreground color black.

Now, when we use Gimp's Text tool, it will antialias with respect to the background color, which just happens to be the average gradient color. Click the Text tool, pick Helvetica 48 Bold Oblique, and in the text field type "MyDomain.Cxm". Click OK, and then move the text (which is selected), to center it horizontally, and between the border and mountains. Click with the rectangle tool to anchor the new text on the Text layer. You'll notice that there are no visible "jaggies". If you zoom the graphic, you'll see that the borders of the text are blended from the black of the text to the lightblue of the #d3e9fb. This is how antialiasing works.

Now it's time to get rid of the uniform #d3e9fb, revealing the gradient beneath. Being sure you're still on the Text layer, right click, choose select->ByColor. Make the fuzziness threshold 0, because we want to delete only #d3e9fb, not any of the very closely related antialias colors. Be sure the selection mode is "Replace". Now click on the image where there's nothing but #d3e9fb, and notice that all of that color (and none of any others) are selected. Now rightclick and choose Edit->Clear, and all #d3e9fb on the Text layer will be cleared to transparent, revealing the underlying gradient. Finally, rightclick and select Select->None to remove all selections. Your graphic now looks like this:

With text

If you don't mind high bandwidth, you're done. Just convert to an RGB jpeg. My webmastering philosophy is to make the site useful for the least common denominator likely to be surfing the net. That means 28K modem. You can reduce the size of the graphic by making it 255 or 16 colors and saving it as a .gif or .png. The smallest file you could make is to reduce it to 16 colors, no dithering, and save it as a .png. That will come in at around 2800 bytes, but the gradient will have lines much like the original. If you had saved it as a .gif, it would have been about 3700 bytes, and had lines. A much better solution would be to reduce it to 255 colors, Floyd-Steinberg dithering, saved to a .png. That comes in at 4700 bytes, but the graphic is beautiful. Saving it to .gif is also beautiful, but it's over 7000 bytes. Note that you can play games with .png compression, but of course there's a quality tradeoff.

To color reduce in Gimp, Rightclick->Image->Mode->Indexed and fill in the proper values.

Fixing the Gradient

If you notice, the gradient of the new file is darker than that of the original because the original's light colors extended farther into the sky. The reason is that our gradient extended evenly from border to border, whereas the original took into account the mountains. To make the new one more like the original, clear the Gradient layer, set the foreground to #b5deff and the background to #f7f7f7. Experiment with dragging the gradient tool only part way down, and you'll notice that the gradient midpoint is higher.

Once you've got the gradient you want, ideally you'll redo the text step so that your antialiasing matches your new gradient.

Summary

You've just used Gimp to create a somewhat complex web graphic. Believe me, it was much harder to create that same graphic in Paintshop Pro 3. In Gimp, you use layers to build individual parts of the image, so that you never faced a situation where a single slip could compromise the whole drawing. By using layers liberally, you also gave yourself more room to work. You accomplished the following:

This serves as a good example of web graphic creation.
Steve Litt is the author of Rapid Learning: Secret Weapon of the Successful Technologist. He can be reached at his email address.

Life After Windows: What's a Good Graphics Program Worth?

Life After Windows is a regular Linux Productivity Magazine column, by Steve Litt, bringing you observations and tips subsequent to Troubleshooters.Com's Windows to Linux conversion.
By Steve Litt
Many friends tell me that Photoshop is the best product on the market, and you can do absolutely anything with it. Adobe sells it on their website for $649.00 -- a bargain for software that can do absolutely anything and is "the best there is".

Except that you don't know what you're buying for $649.00, do you? Are you buying the right to use it forever? For 3 years? For 1 year? Are you buying the right to use it on any single computer, or is the purchase locked to a certain piece of hardware? If your company is purchased or merged, can the new company use your $649.00 worth of "the best there is", or do you need to pay again? Do you have the right to publicly evaluate the software, or is that prohibited by the Adobe license. You don't know until you've paid your $649.00 and read through the click-through license. If you read through the license and don't like its provisions you can always return it. Yeah sure.

So in reality, you don't know whether Adobe Photoshop is a bargain or a ripoff.

It's much easier to estimate the worth of Gimp. You own it forever, you can use it on every computer in your company and those of 1000 or so of your friends and customers. Many Gimp and Photoshop users compare the two as being at least somewhat equivalent in quality and functionality.

Sounds to me like Gimp is worth $649.00. Or maybe more -- you can use it on 1000 computers or 1,000,000 computers -- doesn't matter. Imagine that -- a perpetual site license for only $649.00. Well, actually, $0.00. It's free, both as in speech and as in beer. But Gimp is worth thousands, ESPECIALLY if you're a large company with many users. Does Gimp have all Photoshop's features? Probably not. Is Gimp as fast to use as Photoshop? Maybe, and maybe not. But for most, Gimp is good enough, and you know what you're buying (scuse me, receiving).

Here, in a new browser window (shrink it) is a graphic from the Photoshop web page (shrink . Do you think it would be that hard to do in Gimp?

I'll do it as a 200 x 200 rather than 50 x 50, because it's easier to work with. Then I'll shrink it.

I won't use the background layer for anything. The next layer above that will be what I call the construction line layer. I create line segments for each leaf and for the stem:
Construction line layer

I make a layer for each leaf, and a layer for the stem. I put the proper colors on each leaf with select, fill, airbrush, etc. Finally, for each leaf I used a blur filter to get rid of jaggies and make it look less like a computer drawing. At 200x200 pixels, here's the result:
200x200 Adobe knockoff

And here it is again, this time shrunk down to 50x50 to match Adobe's own graphic:

50x50 Adobe knockoff

OK, it's not 100% exact, but then again, I'm a Geek, not an artist. I'm also not a Gimp authority. The point is that Gimp can do pretty much anything, and when you obtain it, you know exactly what you're getting. To summarize:
Steve Litt is the author of the course on the Universal Troubleshooting Process.  He can be reached at his email address.

Letters to the Editor

All letters become the property of the publisher (Steve Litt), and may be edited for clarity or brevity. We especially welcome additions, clarifications, corrections or flames from vendors whose products have been reviewed in this magazine. We reserve the right to not publish letters we deem in bad taste (bad language, obscenity, hate, lewd, violence, etc.).
Richard Stallman Responds to the
10/2003 Linux Productivity Magazine


Note: This letter was written by Richard Stallman,
and is used herein with his permission.
Please contact Richard for any reprint rights.

Note: When Richard references article "Music on Linux",
I believe he's referring to the article titled "Genesis of an Itch"
The article "Music on Linux" contains a general statement about free
software which is inaccurate.

    It is said that every free software project begins with a programmer "scratching
    an itch". In other words, he needs to do a task, or do the task better, and
    no existing software accommodates that end.

People do say this, but it is not correct.  Many free programs have
this kind of motivation, but many others do not.  This is not why we
have GNU Emacs, or BASH, or GCC, or GAS, or GNU libc, or GNU
Classpath, or Guile, or GNOME.  Those programs, and many other parts
of the GNU system, were written for a reason deeper than practical
convenience.  We developed them for the specific purpose of winning
the freedom to cooperate, for ourselves and for all computer users.

More generally, the article seems to adopt a general attitude of
judging programs solely by their technical qualities, not paying much
attention to the question of how they treat the user's freedom.  For
instance, the article describes MS Word in 1996 as "the best outliner
ever".  It is clear that "best" is meant in a purely practical sense,
since when judged in terms of freedom, MS Word has always been down
with the worst.

It is said, with rather more justification than the other statement
has, that those who don't defend their freedom will lose it.  The
first step is to stop thinking that a program that tramples the user's
freedom can be a good thing.  Start resenting blows to your freedom,
and presently you will find yourself ready to defend it.

As a secondary point, the when the term "Linux" is used in this
article, it really refers (in all cases as far as I can see) to the
combined GNU/Linux operating system rather than Linux itself.  Would
you please give the GNU Project equal mention in the name of the
system whose development is primarily our work?


Editor's Note:
When I refer to GNU/Linux as "Linux", I'm using an abbreviation.
The operating system I use on a daily basis is comprised of the Linux kernel
combined with many GNU utilities and programs, and utilities and programs
from other sources. We GNU/Linux users owe everything to the GNU project and
the FSF. Here are some articles I've written on the subject:




Submit letters to the editor to Steve Litt's email address, and be sure the subject reads "Letter to the Editor". We regret that we cannot return your letter, so please make a copy of it for future reference.

How to Submit an Article

We anticipate two to five articles per issue, with issues coming out monthly. We look for articles that pertain to the Linux or Open Source. This can be done as an essay, with humor, with a case study, or some other literary device. A Troubleshooting poem would be nice. Submissions may mention a specific product, but must be useful without the purchase of that product. Content must greatly overpower advertising. Submissions should be between 250 and 2000 words long.

Any article submitted to Linux Productivity Magazine must be licensed with the Open Publication License, which you can view at http://opencontent.org/openpub/. At your option you may elect the option to prohibit substantive modifications. However, in order to publish your article in Linux Productivity Magazine, you must decline the option to prohibit commercial use, because Linux Productivity Magazine is a commercial publication.

Obviously, you must be the copyright holder and must be legally able to so license the article. We do not currently pay for articles.

Troubleshooters.Com reserves the right to edit any submission for clarity or brevity, within the scope of the Open Publication License. If you elect to prohibit substantive modifications, we may elect to place editors notes outside of your material, or reject the submission, or send it back for modification. Any published article will include a two sentence description of the author, a hypertext link to his or her email, and a phone number if desired. Upon request, we will include a hypertext link, at the end of the magazine issue, to the author's website, providing that website meets the Troubleshooters.Com criteria for links and that the author's website first links to Troubleshooters.Com. Authors: please understand we can't place hyperlinks inside articles. If we did, only the first article would be read, and we can't place every article first.

Submissions should be emailed to Steve Litt's email address, with subject line Article Submission. The first paragraph of your message should read as follows (unless other arrangements are previously made in writing):

Copyright (c) 2003 by <your name>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, version  Draft v1.0, 8 June 1999 (Available at http://www.troubleshooters.com/openpub04.txt/ (wordwrapped for readability at http://www.troubleshooters.com/openpub04_wrapped.txt). The latest version is presently available at  http://www.opencontent.org/openpub/).

Open Publication License Option A [ is | is not] elected, so this document [may | may not] be modified. Option B is not elected, so this material may be published for commercial purposes.

After that paragraph, write the title, text of the article, and a two sentence description of the author.

Why not Draft v1.0, 8 June 1999 OR LATER

The Open Publication License recommends using the word "or later" to describe the version of the license. That is unacceptable for Troubleshooting Professional Magazine because we do not know the provisions of that newer version, so it makes no sense to commit to it. We all hope later versions will be better, but there's always a chance that leadership will change. We cannot take the chance that the disclaimer of warranty will be dropped in a later version. 

Trademarks

All trademarks are the property of their respective owners. Troubleshooters.Com(R) is a registered trademark of Steve Litt.

URLs Mentioned in this Issue

_