[lug] Looking for image manipulation software

Michael J. Hammel mjhammel at graphics-muse.org
Wed Nov 24 10:56:02 MST 2004


On Tue, 2004-11-23 at 20:55, Paul E Condon wrote:
> By subtract, I mean pixel-by-pixel difference of pixel values so that if the two
> input images are identical, the result is an blank image. I can get two images overlaid.
> I can move one relative to another, and if I spent another few hours looking I might
> find a way to input x,y shifts as number of pixels rather than using the mouse to
> drag and drop. But even when I do get them overlaid with the mouse, that only increases
> the contrast of the image. Choosing modes subtract or difference doesn't help.

Everyone else has mentioned non-GIMP tools.  I'll cover GIMP.

First, GIMP's layer modes Subtract and Difference are not the same. 
Difference is the one you want.  Subtract will clamp the result to 0
(black) even if the operation produces a negative value (the higher
layer pixel values are larger than the lower layer) while Difference
will take the absolute value of the result.  So if the colors for a
specific pixel are exactly the same, you get black.  Whether or not that
is the same as "blank" to you is a matter of opinion. :-)  Both modes
apply the operation with the higher layer subtraced/differenced from the
lower layer.

Offsetting a layer is simple in GIMP 1.2 - Image->Transforms->Offset
(Shift-Ctrl-O).  You can shift by any number of pixels in the horizontal
or vertical direction.  The same is possible in GIMP 2.0 but I don't
have that running at work right now so can't tell you if its in the same
place.  It's probably under the Layers menu now instead of under the
Image menu.

Layer alignment is possible with stock GIMP tools (Layers->Align Visible
Layers) but its pretty meager.  I wrote a plugin for layer alignment
that is more interactive and allows you to align on any layer as the
base.  It's called GFXLayers and is part of the Graphics Muse Tools
(www.ximba.org/gfxmuse/gfxmuse.html).  This only works with GIMP 1.2
right now.  I haven't ported it yet to GIMP 2.0.  The tools are BSD
licensed.

If you want to all of this work (sans my plugin), create a black
background.  Then create a new image and fill with red and a white
stripe near the left edge.  Offset the new layer by 1/2 (the Offset
dialog makes this easy - but turn off the Wrap toggle).  Then set the
layer mode for the new layer to difference - the colors don't change: 
black (000000) - red (ff0000) = abs(-ff0000) = red.  Change the mode to
subtract and the whole thing goes black.

Change the background to red:  Set the new layer mode to subtract and it
and the white stripe go black.  Set the new layer mode to difference and
the white stripe goes cyan while the rest of that layer goes black.

Once you figure out how the layer modes work, the rest is tweaking the
alignment.  This sort of work is already done by various groups doing
medical, radar and space imaging using GIMP, though I say that having
only heard they are via the mailing lists (not actually discussed it
with them).

Hope you don't mind but I'm going to use this idea for an article.  I'm
doing the graphics/GIMP column for the new Tux Magazine from SSC, not to
mention my regular gig with Linux Format in the UK.  So I'm always
hungry for new problems to solve with the GIMP.  :-)
-- 
Michael J. Hammel                               The Graphics Muse 
mjhammel at graphics-muse.org                      http://www.graphics-muse.com
------------------------------------------------------------------------------
The one thing that unites all human beings, regardless of  age, gender,
religion, economic status, or ethnic background, is that, deep down inside,
we ALL believe that we are above average drivers. -- Unknown.




More information about the LUG mailing list