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

Discussion in 'Python' started by norseman, Jun 25, 2009.

  1. norseman

    norseman Guest

    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
    ( and ) 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 <>:

    > 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

    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.

    norseman, Jun 25, 2009
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    Gordon Beaton
    May 17, 2005
  2. \A_Michigan_User\
    Aug 21, 2006
  3. Saraswati lakki
    Saraswati lakki
    Jan 6, 2012
  4. Kamaljeet Saini
    Kamaljeet Saini
    Feb 13, 2009
  5. F.R.

Share This Page