[Gimp-user] Color change a whole range based on a break point

norseman norseman at hughes.net
Thu Jun 25 17:23:04 EDT 2009


I know I'm not the only one that does archival scanning and 
georefferencing of old maps.

What follows is the combined conversations between myself 
(norseman at hughes.net and saulgoode at flashingtwelve.brickfilms.com) that 
lead to getting what is needed for the above process when working with 
sources that are copies made with the "Sepia" process of old (before 
Xerox copiers). Namely; a clean raster.  For non-sepia source I use 
GIMP->Colors->Levels and get excellent results with minor effort.


         1)  original request and reply
 > > Wanted:
 > >          In Gimp, to add (SUM) the RGB values for a pixel and then
 > > change all pixels who's RGB SUM is greater than a user stated value
 > > to WHITE.
 > > Second side of that is to change all RGB SUMs less than value given 
to Black. BUT not doing both at same time, thus allowing user to "step"
 > > in and see what got lost.

* Duplicate the layer.
* Desaturate the duplicate using the "Average" method.
* Add layermask to the duplicate using the
    "Initialize to: Grayscale Copy of Layer" option.
* Bucket fill the duplicate layer with white.
* Run "Colors->Threshold" on the layermask, setting
    the value appropriately.
* Bucket fill your original layer with black.

         2) starting round 2
Quoting norseman <norseman at hughes.net>:

 > I understand the idea. I am not getting any usable results.
 >
 > If I cut out a small piece of a project raster and send it to you
 > would you have the time to try your idea(s) on it?

That would be fine. Perhaps I misinterpreted what you are trying to 
accomplish.

         3) closing results
As often happens, just as one is ready to quit, the unexpected happens.

I went back to your idea of Desaturate and Threshold and tried them 
without doing the layer/fill parts. (keep original, save as newname the 
modified)  Success!

What I have is 45 year old sepias of USGS 7.5 minute Topo Quads with 
inked lines drawn on the sepia.  They have 'faded' and the surface has 
corroded and some has rubbed off onto the inked lines originally drawn 
on them. Thus the black lines are tainted with color. The rest of the 
sepia is like any other old sepia. It is trying to become all one color 
- very dark sepia. :)

What I did was try your idea of Desaturate (I settled on the Lightness 
setting) and then used Threshold (left or 'black' side set to 50 +/- and 
right or white side set to 200 to 220) and BINGO! -- I get what I want! 
The sepia (very nearly 100%) turns white and the inked lines are dark 
enough for further processing. Final manual touch-up prior to 
vectorizing will be very minor. Manually doing the major cleanup is less 
than 60 seconds per sheet. Majority of sheets take less than 30 seconds. 
Anticipate individual settings and times to vary with source conditions. :)

Final product is to be inked lines converted to georefferenced vectors.


side note:  the 'small sample' I had clipped out was small compared to 
the original sheet but it was still 25 megabytes AFTER LZW compression!
The original sheets are 200 megabytes each in uncompressed RGB Tiff. A 
totally manual cleanup of originals is definitely an unwanted task.


GIMP: 2.6.6
OS  : Window$ XP PRO
As of writing, I have not tested on Linux but I do expect same results.

Sincerely - I do appreciate your help.


Steve



More information about the Python-list mailing list