[GRASS-dev] problem with r.colors on Mac

Michael Barton michael.barton at asu.edu
Wed Apr 11 00:13:54 EDT 2007

On 4/10/07 7:04 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> Michael Barton wrote:
>> I just have been having problems with r.colors on the Mac. This is from cvs
>> source code I downloaded and compiled today.
>> r.colors will crash the GUI when I run it with either grey.eq or grey.log as
>> the color map. It seems to calculate the equalization stretch OK with
>> grey.eq, though, in spite of crashing.
> My guess is the gronsole code. Running r.colors from the command line
> with GRASS_MESSAGE_FORMAT=gui doesn't show anything unusual.
> As I've mentioned before, the use of "read" with non-blocking I/O is
> likely to be problematic if the program generates output quickly. If
> there's a problem here, r.colors is a good candidate to trigger it as
> it will generate percentage output relatively fast.

This hasn't happened before for me with r.colors. Other things that run
faster haven't given me problems before, though this has happened with
v.to.rast. Your explanation may well be the correct one. But I wonder why it
is a problem now and not previously (i.e., a month ago).

If read is a problem, what is an alternative? I don't understand the
gronsole code very well (didn't write it), but I might be able to fix a
specific issue like this.

>> r.colors gives me a blank (i.e. white) image if I use grey.log. I list the
>> color table below. As you can see, it¹s just white.
>> color table from grey.log
>> % 43844 43964
>> nv:255
>> 43844:254 43963:254
>> 43964:255 43964:255
> This is expected behaviour; grey.log maps a value of x to
> 255*log(x)/log(max); the minimum value is ignored. IOW, it *doesn't*
> map the minimum value to black, it maps 1 to black (log(1) == 0).
> I don't know whether this is a good idea, but it is how grey.log has
> always behaved.

I had thought that grey.log was a histogram stretch like grey.eq. In the
docs, it is called "histogram logarithmic transformed grey scale". In that
sense, it seems like it should set the minimum value to black rather than 1.
Thanks for the explanation. Would it be difficult to change this to stretch
the image histogram rather than values of 1 to n?


Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

More information about the grass-dev mailing list