Day-to-day thoughts, technical information, a random grab-bag of thoughts, discoveries, and interesting little tidbits.

Saturday, December 24, 2011

Ron Paul's Newsletters and Response

I am a supporter of Ron Paul.  I do enjoy his current position, and I do see him going further as time goes on.

However, I have seen, both in this presidential run, and the last one, comments regarding a set of newsletters.  These newsletters contained articles that had racist, anti-semitic, and other really nasty things.  A popular example used is the following quote:

"Order was only restored in L.A. when it came time for the blacks to pick up their welfare checks three days after rioting began"
Now, this sort of thing should have been caught.  Ron Paul has acknowledged the issue, and has both apologized for the oversight, and disavowed the statements. Certainly, no new articles have appeared to demonstrate that he has let the issue continue.

But there are those who won't stop asking about them.  They argue that he knew these comments were in the articles, because he knew details about the newsletters' content when he advertised them.  They claim that these prove that the congressman is a bigot and an anti-Semite.

First of all, the advertising clip demonstrated he knew the general content of the newsletters.  He did come up with them in the first place as a means to educate the public.  Second, it is well-known that many of the articles were ghost-written.  Third, he was busy operating his medical practice at the time.  Fourth, he has not located and outed the guilty party.

When talking about the advertisement, keep in mind, that he did not give the hint of bigoted talk you would hear from a typical racist; he extolled the virtues of the free market, and talked about the faulty policies he did not believe in.  In fact, in absolutely none of the videos I've seen with him talking has he ever taken such a stance on race, or even quipped wise against specific races.  In fact, even attempts at wisecracks (such as the one regarding Bachmann) don't seem to slip very easily from his mouth.

I don't care how well-schooled you are, or how much self-control you possess, sooner or later, comments will slip.  And considering how hesitant and sputtering his speech can be at times, I can't really believe he's THAT good at public speaking.

There are two reasons why he would withhold the name of the ghost writer.  First is the possibility that such a person is a friend; in fact, some have stated a likelihood that the guilty party is Lew Rockwell.  Yes, such friends can be bad for you, but at the same time, we all have at least one friend we would vehemently disagree with, but would still help in hard times.  That's just human nature.  And you don't throw friends under the bus because it suits you.

The only other reason I can think of is that he really doesn't know.  This is a less likely scenario, I'll grant you, but these letters are at least 2 decades old.  If there was a guilty party, they may be harder to track at this point.

As for the negligence, how many stockholders owned stock in Enron or Haliburton?  How many of them take a personal interest in these projects?  At the time of these newsletters, Ron was a doctor, not a politician; he was not thinking about political office, and likely trusted the people who were maintaining the articles, and besides, they didn't say (theoretically) anything he didn't already understand.  In this case, we know what happens when you assume.

This is a lot of rambling, but here's the point:  I hear a lot of "he has to answer for these newsletters," but apparently, the answers he gave for them are apparently not satisfactory.  So I pose to you, media and questioners: what exact questions are you asking?  What specific information will you accept as sufficient from him?  Or are you unwilling to accept anything other than confirmation that he is a horrid, bitter man with bigoted stands toward his fellow man?

Friday, December 9, 2011

The Before-Death Experience

The Hitchhiker's Guide has this to say about the before-death experience:

It is said that before you die, your life passes before your eyes. This is, in fact, true; the process is known as "living."  This is a horribly tedious process, sometimes pleasant, such as times when one is enjoying tea and fairycake, and other times, less so, such as when attempting to explain to the Vogons just why their planet should not be demolished to make way for a hyperspace bypass.  And less so when listening to the reaction on the part of the Vogon who, in a fit of inspiration, decides to share a poem about the types of muck found between their toes one midwinter night.

Some people will seek to shorten this process, especially when listening to said poetry, in order to be on time for tea in the afterlife; fairycakes optional. Others, unwilling to experience the unpleasantness of "dying," particularly those who have not yet heard a Vogon reading poetry, will do everything in their power to extend the period, only to discover just how tedious the whole "living" process really is, until they can no longer stand it, and die anyway, usually in the middle of a dream of tea in the afterlife.  Of course, these people tend to become confused as to whether they will ever wake up on time to have their morning tea, and then decide that it's not important, as there's a perfectly good cup in front of them.

Sunday, August 14, 2011

Linux Creativity Podcast

Here I am, preparing to begin a podcast from Linux.  There are a few things I am sure I want:
  • I want the podcast to sound professional, as if it was syndicated as part of a larger network.  Even if it's not, it definitely gets the attention of someone who might otherwise just ignore it.  This means that the podcast will need to have:
    • Opening Music for the intro, small riffs for the bumpers, and closing music for the outtro.  I'd consider creative commons, but I'd be leery of non-commercial or share-alike licenses.  Attribution won't be a problem, though.
    • Discrete sections, including the opening, commentary, news, main topic, mail, tip, conclusion, and closing.
    • A steady release rate, preferably weekly.
    • An easily-remembered name.
    • A primary domain name (something.com).
    • A content-managed website, preferably with a forum and a show notes section.
    • Co-hosts with some experience in the fields I'll be covering (dialog sounds more natural than prepared scripts, and it would help to have someone coming from a creative background, as opposed to my extensive Linux background.)
    • Consistency.
  • I want to focus on the audio technologies in Linux.  I am comfortable with:
    • Jack (for sound channel manipulation)
    • Ardour (for recording and mixing)
    • LADSPA, LV2, and VST plugins (for audio filtering)
    • Jamin (for mastering the final).
  • I want to cover topics regarding the professional creative use of Linux.  There are a lot of podcasts out there that cover Linux for technicians and business people, I want to focus on the creative tools of Linux.  At first, I intend to focus on audio production (such as creating podcasts in Linux... how's that for meta?), but I have spent time getting comfortable with programs in other fields of creative endeavour, such as writing, computer graphics, and video.
Now, it really doesn't matter to me what momentum this podcast will create.  I am not an expert in any of the fields I want to cover.  I just want to get Linux to the attention of the creative types who are not aware that it can be used in place of the massively-expensive suites provided by the likes of Adobe, Apple, and Avid.  Additionally, this will also give me practice in both Linux audio production as well as voice work to add to a future demo... never mind the ability to say I participated in a professionally-produced podcast.

Friday, July 8, 2011

The Simple Linux Desktop

These days, there are a number of major desktop environments out there that can make the Linux desktop behave like a Windows or Mac desktop.  This is a good thing, where people from those environments are concerned, as they won't have to do a lot of learning right away.  Everything they expect, such as icons, the taskbar, desktop menus, and other common items are right where they would normally look for them.

But what about those of us who prefer the spartan way of computing?  Those who find the window manager shouldn't have gained any more features than drawing borders around windows, and where the desktop is just the screen where windows appear often finds the presence of start menus, taskbar, eye candy, and icons an unnecessary distraction, while the number of programs required to run in order to produce those visual elements robs the simple performance of whatever app is being used at the time.

In an effort to remove the complexity of the desktop environment, I've found the use of several tools work just as well for a desktop, provides a flexible user interface, and still gets the work done.

One thing I would like to note: originally, I cursed the existence of the "useless" Windows key, but since working on this desktop project, I've  come to love it for its one major benefit... the very uselessness I originally hated it for.  Since it's useless, I can make a use for it, and not have to use any of the other keys that more frequently already have uses in other software packages.



Before we begin, I will make a point of noting here: This is an advanced setup process.  Compiz will probably be the easiest part to set up due to its graphical setup and reasonable defaults once the plugins are enabled.  The rest of the tools, while having GUI tools for setup, are much better handled in their text configuration files, where the flexibility of this desktop will shine.

With that being said, however, keep in mind that once the tools have been configured, they don't need to be modified again unless you plan to redecorate. Constant tweakers need not apply, this is for those folk who just want a simple desktop to set up and use without worries that it's going to change on them.



The Desktop

The desktop itself needs to have all the elements necessary to create windows, borders, and just enough interaction to do things with those windows and borders.  Older hands prefer classic window managers like twm, fvwm, or *box, but we can actually have a lot of eye candy from a much more flexible (and potentially-pleasing) window manager, Compiz.

Unlike the classic window managers, Compiz lacks most of the desktop elements one would expect with a window manager, such as desktop buttons, icons, or even a root menu (a sort of "start menu" that appears when clicking on the wallpaper).  Any additional features will need to be added by other specialized programs later.  But don't think this makes it too simplistic.

Compiz has a configuration program called "ccsm", which means "Compiz Configuration Settings Manager."  This application has a GUI interface to a whole host of settings, which include both special effects, such as the desktop cube and wobbly windows, as well as the more important stuff, such as which keys and mouse buttons can affect windows in which ways.

To save you some trouble, here are the basic Compiz plugins to activate to have a completely usable standalone desktop with Compiz:
  • In the "Effects" section:
    • "Window Decoration" actually draws the window borders.  Yes, you really do need a plugin for that feature.
  • In "Window Management":
    • "Application Switcher" allows the standard ALT-Tab window-switching behavior.
    • "Move Window," which allows windows to be moved around on the desktop.
    • "Place Windows," which determines where brand new windows appear on the desktop.  I prefer "Smart Placement," which places new windows in areas with little window covering.
    • "Resize Window," which allows windows to be enlarged or shrunk.

Now, I would be lying if I said I didn't want some of the more awesome effects of such a nice window manager, and since I'm saving massive amounts of resources by not using a full desktop, I can have several extra toys running:
  • In "Desktop:"
    • "Desktop Cube," which is like virtual desktops on steroids.  Despite the name, it does not necessarily need to be a cube; the number of faces are actually flexible, although they all need to be placed in a horizontal arrangement... no complex "desktop multihedrons" unfortunately. 
    • Rotate Cube, which allows you to switch "faces" on the cube using the mouse and/or the keyboard.
  • In "Effects:"
    • "Animations;" opening, closing, minimizing, maximizing, restoring, and shading windows all have special effects assigned to them.  If you have a task bar, they usually interact with that.  If there is no taskbar, windows usually "disappear" into the mouse, regardless of its actual location on the desktop.  It looks pretty slick to watch windows just get "sucked" into the mouse pointer.
    • "Animations Add-ons" add more animations for the windows to perform.
    • "Wobbly Windows" can give the windows a stretchy, rubbery feel.  Also, if you hold down Shift while moving a window, it will snap to the nearest window or desktop border.
  • In "Extras:"
    • "Screenshot" is a useful option; instead of taking a full-screen snapshot, you can hold down the Windows key, drag the mouse using the left mouse button, and the screen will show an outline.  Let go of the mouse button, and everything in that line will become a screenshot in the chosen directory, and can even be shown in your preferred image program.
  • In "Window Management:"
    • "Group and Tab Switcher" essentially allow you to "glue" windows together.  Grouping windows will mean that if you move one window in a group, they will all move as one.  Tabbed windows are even slicker; if you set up a group of windows into a tab session, then holding the mouse over the border will show all the tabs in that group; clicking on any of the tabs (or using Windows-Left or Windows-Right) will cause the window to visibly "flip over," revealing the desired window on the back of the previous window.
    • "Maximumize" works similar to "maximize," but instead of the window filling up the whole screen, it simply grows to fill the available unused space it's in.  Unlike Maximize, however, it does not return to its original size; "Minimumize" will simply shrink the window down to its absolute minimum size possible.
    • Shift Switcher allows Windows-Tab to change windows, but unlike the Application switcher, which treats the windows like a slide show, this one shows the windows as if you were flipping through records.

Desktop Components

Now that the window manager is active, let's next focus on the visual elements of the desktop.  The basic tools are the toolbar and the task tray; items that are needed for one to be able to switch between windows, and to hide items that don't need to be displayed to function.  Additional items can be found in simple notification widgets, such as a system monitor.

Task Bar

Tint2 is probably the most lightweight and simplistic taskbar I could find, especially as it includes a task tray, doesn't include a start menu, and even has a clock included.  Additionally, this toolbar has alpha blending, meaning it can be translucent without being transparent.  Finally, it does not interact with windows on the desktop, which means it isn't going to reduce the desktop size one iota (toolbars should only be seen when needed).  If you activate the "Widget Layer" feature of Compiz, you can then set a hotkey to show it only when you actually need it, leaving the desktop entirely empty for other uses when you don't.

System Monitor

Conky  is a system monitor widget with a lot of optional extras, from temperature monitor, to music player information, to RSS Feed reader.  In my case, I just use it to function as a desktop clock, performance monitor, and disk space notifier.  It sits in the background, translucent, and doesn't interfere with the rest of the windows, which works for me.  Some tips: enable argb_visual features to allow Conky to interact with Compiz's transparency, enable double-buffer to prevent the annoying flickering seen in the default setup, and browse other peoples' configurations via Google for ideas on how you can use it.

Launching Applications

Of course, a good-looking desktop that is unusable is a waste of time and effort, right?  Of course.  Two tools will be useful for launching applications.

Keyboard Launcers

xbindkeys is a simple tool with a simple purpose:  Wait for special keyboard combinations, and then run the specified program.  This allows me to set up Win-F1 through Win-F12 (and combinations including Win, Alt, Ctrl, and Shift) to launch programs.

Now, there is not a lot of documentation regarding which codes are assigned to which keys.  However, if you launch xbindkeys with the "-mk" switch, the program will sit and give you the exact keypress names it expects as you press the keys themselves.  This can be a boon to making the configuration files as needed.

The only downside to this program is that it does not also detect mouse activity.

Mouse Menu

Some people prefer the old start menu.  Nothing wrong with that, although it seems like more trouble than its worth... but that's just me.  For those who really need a good standalone root menu (remember, Compiz does not have one), there is myGtkMenu.  This program is simple: it reads a text file you make, and shows a menu.  The configuration file is just a list of three-line entries, separated by spaces, consisting of item name, program to launch, and path (if any) to the program's desired icon (or else just NULL).  Submenus can be created, all you need is a name, and the icon name, following which all items in that menu have an additional tab before they're entered (if you're familiar with Python, this should be pretty simple to understand).

Now, keep in mind that XBindKeys won't detect mouse presses, but Compiz will.  If you plan to set this menu up, you can use the "Commands" plugin in Compiz settings to add the command to open the menu, and assign a key/mouse binding for it.



Now, it wouldn't be much of an explanation without some screenshots, would it?  So, here are two.



The first one is a screen in normal mode; note that aside from the browser, there is no task bar.



Now, we see the window is darkened, and the task bar is present.  The screen is in "Widget Layer" mode, which is what the task bar is assigned to.



At this point, I've described my own desktop (plus the menu; I prefer using xterms to launch programs). It's simple, but immensely flexible, and I doubt I'll be seeing it mucked about by upstream authors anytime soon, so I can forget about fighting the interface, and just use my computer as I want to.

I hope you enjoy this, and find inspiration with it!

Saturday, June 12, 2010

Giving Microsoft Windows the Linux Desktop

I am a Linux user.  I am such mainly because I'm most comfortable with the way Linux does things, and there's absolutely no limit to the customizations I make.  As a result, I've become comfortable with the interface I've grown accustomed to.

In my case, window focus follows the mouse, clicking on a window does not cause it to pop to the top, covering other windows, and moving or resizing said window is simply a matter of holding Alt and dragging (left or right, respectively) in it.  Additionally, I use a trackball, and in Linux, I configured it that holding one of the trackball buttons turned the trackball into a scrollball, and releasing the button would immediately return the trackball to the normal mousing mode.  And finally, I use an extremely spartan desktop; I run Compiz standalone (meaning that I don't have a desktop environment), with xbindkeys and MyGtkMenu working as hotkey controller and desktop menu, respectively, GKrellm as the system clock and status tracker, and stalonetray as a tray tool.

This kind of interface does not exist in Microsoft Windows, as the click-to-focus-and-raise model is pretty much standard.  And while there's a vague imitation of focus-follows-mouse in the accessibility options, clicking in a window still activates and raises said window.

Given that my current job, which is a work-from-home kind of dealie, requires me to use Windows, I felt the need to modify it to more closely behave like my Linux desktop.  Given the lack of customization options available for Windows, this seemed like a pretty daunting task.
I eventually discovered tools, however, to make the Windows desktop function almost perfectly like my Linux desktop.

First, I want to get rid of all the extra baggage that comes with a Windows desktop, so I want to get rid of the taskbar at the bottom.  All of it.  Nothing visible but desktop, perhaps with  the exception of the system tray.  So, I download and install the Emerge Desktop, which is a minimalist and modular shell replacement for Windows.  It has a system tray program and a task tray program which do the work I want; I can now have nothing but process icons lining the bottom of the desktop, at 16x16 resolution, with tasks on the left, and the tray on the right.  Nothing else.  This may be too minimalist for some, so there are other shell replacements for Windows as well; a popular one is bblean, a replication of the Fluxbox environment for Windows.

Second, I use gkrellm on Linux, and by gum, there's a Windows port of it.  This is a good thing, and something I take full advantage of.  Now, I have a system clock.  I've yet to muck about with the other krells, but time will bring opportunities for experimentation.

Next, sloppy-focus.  Windows is notorious for its click-to-raise tendencies; and I always preferred the stacking order to remain until I consciously decided to raise a window, regardless of whether I'm typing in a window, or clicking on window elements, such as buttons, menus, or a scroll bar.  Windows does have a focus-follows-mouse feature, but clicking in a window still follows the original click-to-raise model.  Enter True X-Mouse.  This tool causes Windows to perform the focus-follows-mouse action correctly.  It also introduces Linux-style copy/paste to Windows (highlight to copy, middle-click to paste), but this interrupts the middle-click features in Firefox, and even in Linux, I tend to use the Ctrl-C/Ctrl-V model, so in HKEY_CURRENT_USER\Software\<appro@fy.chalmers.se>\TXMouse, I create the strings "ExemptedClasses" and "ExemptedModules", setting them both to "*".  At this point, I have focus-follows-mouse, and no middle-click paste, which works for me.  (If you don't see the above key, you can make it).

Next, I want the ability to move or resize windows using the left and right buttons in combination with the ALT key; this means I can move or resize a window, even if the appropriate titlebar or border is not onscreen.  So, we make use of another utility that allows this: Win-X-Move.

At this point, mouse-based users are done; the desktop heavily resembles and behaves like a Linux desktop.  However, I still am using a Logitech Marble trackball with 4 buttons; two big, two small.  My Linux configuration makes the left small button a "scrollball emulator"; holding the button causes the trackball to simulate a scroll wheel that can scroll both horizontally and vertically.  The small right button is meant to be a middle button.  However, the SetPoint software does not quite meet the needs; universal scroll is a press-to-engage, press-to-disengage process, and the right-hand small button cannot be programmed to be a middle button.  So, I replace SetPoint with X-Mouse Button Control, which is a much more flexible mouse button remapping tool, and Marble Mouse Scroll Wheel, which sets the scroll functionality to perfectly match the linux variety.

Now, onto the virtual desktops.  True, Emerald Desktop has its own virtual desktop manager, but it's relatively anemic, and doesn't work with Vista/7 without administrator rights.  So, instead, I installed VirtuaWin,  a tray app that will handle multiple desktops without much difficulty, and has an incredible flexibility with the use of hotkeys. 

Finally, we come to the shortcuts.  I tend to use F1-F2 in combination with Win, Win-Ctrl, Win-Shift, and Win-Alt to launch programs.  There's enough of a space (48 combinations) there to handle the bulk of the applications I use on a regular basis, and then some.  I also use Win, Win-Shift, Ctrl, and Ctrl-Shift with the number pad to quickly access the various websites I use on a regular basis (36 combinations).

For the above combinations, I found that AutoHotKey not only fits the bill, but also provides the ability to use "hotstrings," which replaces something you type in with something else, either for the purpose of a correction of a misspelled word, or also for the expansion of acronyms/keywords.  This tool also allows me to make executables that will launch whole groups of applications simultaneously.

Well, that's my Windows desktop.  I still don't have Alt-Click to raise/lower, snap to edge, desktop cube, or wobbly windows, but this is a lot closer than I started with.  If anyone knows a way to accomplish these from Windows, I'd certainly appreciate the suggestion.

Tuesday, December 15, 2009

Sounding Off

I finally got around to learning how to use the JACK Audio Connection Kit, which, as far as I'm concerned, is easily a contender against the big names like Pro Audio, Cubase, or any sound program by Adobe.  Sadly, Audacity doesn't cooperate with the virtual patch panel, but the Ardour DAW seems to fill in the gaps quite nicely.  Combine this with Jack Rack (a tool to integrate various sound filters into the patch panel) and Jamin (a audio mastering interface), and there's a nigh-professional sound editing system at my fingertips.  And if I need to do some post-processing, well, Audacity will fit the bill quite nicely.

I could use this to produce some interesting things; I have had some recent interest in performing audio theatre podcasts, perhaps do some voice-over work in the longer-term future... who knows?

Jack Audio Connection Kit
Audacity Sound Editor
Ardour Digital Audio Workstation
Jack Rack Audio Effects Toolkit
Jamin Audio Mastering Interface

Sunday, October 4, 2009

Cleaning up Scanned Documents with the GIMP

Recently, I've decided that I don't really want to keep a lot of paper documents lying around, such as bills and receipts, but I also don't want to lose the information they contain.  So, I decided to scan them into my computer, and store them as images, eventually to be converted into PDF format.

After scanning in the first document, I came across the problem that no doubt a lot of you encounter; the scanned document is sort of off-kilter, no matter how determinedly I aligned the paper on the glass.  Additionally, the document's background seemed to be inconsistently shaded at best.  Of course, there's also the ever-present black border where the paper did not cover the glass.  Obviously, this would not do.

After an hour attempt, I started to put together a method of cleaning up documents to the point that they would be cleanly replicated on the image file, to the point that signatures could even look realistic.  This article describes just how this happens, and how it can be corrected.  For simplicity's sake, I will describe this using the free Photoshop workalike known as the GNU Image Manipulation Program (or Gimp, as it's usually shortened to).

Common Issues and their Causes


The following image shows the basic layout of a scanner and the document placed in it.



The blue box at the right is the scanner's lamp and imaging system; it goes over the glass at a consistent rate, and constantly takes snapshots of its location as it goes.  Under perfect conditions, where the paper is perfectly aligned and flat, where the lamp is the only source of light there is, and where the lamp/sensor itself is perfectly aligned, this can result in a perfectly clean scan with no artifacts or strange bending.

However, such perfect scanners generally cost in the megabucks, so the typical scanner is generally "close enough," in that the document is clean, clear, and not too badly warped, and is mostly legible.  The developers of such scanners expect the cleanup to be done in software, so the tolerances can be a bit more off than the more expensive devices.




You'll notice with the above pictures that the blue lamp/sensor device isn't completely aligned with the paper.  It will still scan straight, but it results in one of the more common faults of scanned documents: shear.  This means that one side of the scan will be captured earlier than the other side, causing the whole document to look crooked, as the above illustration shows.  What makes this a bit more annoying is that rotation alone won't fix the problem, as it will simply rotate the text as well as the lines and borders.

Another problem that often pops up is the strange "fog" of color that warps over the image, usually marbled based on imperfections in the paper; the lamp puts out a steady light that is reflected off the paper and returned to the sensor on the assembly.



 As you can see, the first example shows a perfect scan, if the paper is perfectly flat and even.  The second example is a bit more realistic; paper consists of millions of miniature bumps, and is usually something less than perfectly flat, especially if it was handled in some way, and definitely if it was recently folded or crumpled.  In this case, those areas that are further from the glass (and lamp) become slightly darker, and the texture of the paper itself can affect the darkness somewhat.  This is the source of the colored (or gray) "fog" that can cover a good portion of the paper.

Example Document Used

 The following document will be used for the examples; it was scanned using the green channel at 300dpi with an 8-bit grayscale.  It was originally part of a larger, but mostly-obsolete document I had stored in a 3-ring binder for a while (for those curious, it was from the "Encrypted Root Filesystem HOWTO" website).
The reasons for my scanning choices are as follows:
  • 300dpi is the typical resolution for a mid-grade laser printout of a document.
  • The green channel generally has the least defects (less splotchy fog, and more smooth, faint fog)
  • The 8-bit grayscale will cover approximately 256 shades of gray (makes an excellent starting point toward clearing the fog).

Correcting Document Shear

The first issue that will need to be resolved is the straightening of the document.  This is not very hard to accomplish, but it does require some patience and practice... and a little help with the guide and shear tools in the Gimp.

The first step involves a calculation: You need to determine how wide your total scan is, and then place a vertical guide at the exact (or bordering) halfway point.  Then, you need to locate a line long enough on the document to compare ends, and align a horizontal guide exactly where the vertical guide and the document's line meet:



In the case of my example, my flatbed scanner has a maximum width (at 300dpi) of 2563 pixels, so 1281 would be an appropriate location for the cross.  Also, notice the dotted blue line going across.  On the far left and far right of that border, the blue line is above and below it, respectively.

Now that the guides have been placed, we can now use the shear tool in the Gimp.  In the toolbox on the right, look for the shear tool:



Up will pop the shear dialog box, which contains two options and four buttons:



 When you make changes to the values in the magnitude options, the displayed image will automatically update as a preview.  The easiest way to ensure you don't overshoot the mark is to use the up and down arrows to the right of the entry fields to take the changes one step at a time.  In this case, we want to change the "Shear magnitude Y."




The above picture shows the before; here you see the shear box with both 0 entries, and the image below with the two guides.  Notice that the horizontal guide shows just how bad the shear is on the document.  In the following image, however, all of this is corrected:




Here, you can see that the lines are now matched up, and since the guide lines are always perfectly horizontal and vertical, you know that the document has been corrected.  Something to keep in mind, however: when you try this, you'll notice that while you're doing the shearing, the lines will become jagged and uneven.  Once the process is completed, the jagged lines will be corrected, and everything will be smooth and straight.

Correcting "Scanner Fog"


Now, you'll notice that the image does have a hazy gray color over most of the surface.  Most of the time, the haze is paler than anything else on the page, which means that cleaning it up is just a levels tool away.

The levels tool is designed to change how light the lights are, and how dark the darks are.  You can activate the levels tool by going to the "Colors" menu and clicking on "Levels..."  You will then see the dialog box shown below:




Most of what you see on this dialog box is unimportant for our purposes; all we're interested in is the histogram and the input level controls.  The histogram is the big white box above, with the black "mountain" shown in it.  Beneath it, you see three triangles under a gradient.  We'll call those triangles the blackpoint, greypoint, and the whitepoint, as they mark where the black, middle gray, and white are in the image.

The histogram is essential to the task of cleaning the fog.  You'll notice the mountain showing up at the far right of the dialog.  That mountain happens to be just above the very light gray part of the grayscale.  This means that each of those shades of gray have a lot of pixels of that brightness.  At this point, you probably realize that the mountain describes the pixels in the scanner fog, which is usually in that brightness range, as compared with the actual text, which is considerably darker.

Underneath the histogram, we have the grayscale with three triangles.  Those triangles generally adjust where the black color starts lightening up, and where the white color begins to darken.  To fix the problem with the scanner fog, we need to move the white arrow to the point just left of the mountain, which will turn all the pixels of scanner fog pure white, essentially losing those pixels as data (don't click OK just yet):


But, now we have a new problem: the text in the document has become quite faint!  Well, that can be corrected as well.  Notice the low, long hill on the left side of the histogram?  Those are the pixels that contain the content, much of which was black on paper.  We just need to move the black slider to the right so that hill is above the black region at the bottom:

As you can see, the document has been darkened again, but the fog is still gone.  As you can see, the "fog mountain" in the histogram is now above the pure white region, making all "fog" pixels white, while the "content hill" is now completely above the pure black region, meaning that much of the content is now back to black.  For the most part, the corrections are mostly done.  To remove the punch-holes on the left-hand side, a quick swipe of white paint will fix it in no time.

Now, you'll notice that the borders are a little off, and, of course, the black border is still there.  Cropping is the word for this occasion; a tool that will delete everything outside of a rectangular region you select.  Simply open the tool, adjust the borders to match where you want the page cut, and voila.  To begin, you need to select the crop tool from the toolbox:

Then click and drag from one corner of your desired selection to the other, using the boxes along the edges, and over the corners to resize the selection to crop. It is recommended that you also make use of the zoom function if you want to crop only what is necessary to clear away the outer edges:

To complete the cropping process, you simply need to click on the inside of the crop selection, and it is done.


You might notice that the gray regions are not all that even.  This can have multiple reasons, but the main reason is often that the printer that produced the image was not perfect, either, putting more ink/toner into some dots/regions than others.  In this document's case, it was getting near the time when fresh toner would be needed.  Even though these techniques cleaned up the document quite nicely, remember that nothing changes the fact that unless you actively change the document yourself, you can at best get on the screen exactly what was on the paper you scanned.

Well, enjoy this technique, and good luck!