On Sun, Feb 12, 2006 at 06:02:48PM +0100, Thomas Lineal wrote
> Dear Community,
> 
> i am receiving satellite images from the new MSG satellite. In this
> image, the darkest pixel has e.g. a value of 67 and the brightest a
> value of 203. I am looking for a tool which makes the dark pixels
> darker and the bright ones brighter. How can this be done using
> ImageMagick?

  I suggest using convert with the -fx option.  I assume that pixel
brightness is in the range 0..255 and you want to use the entire range.
First we need a funtion such that f(67) = 0, and f(203) = 255.  There
are many possibilities.  The simplest is a straight line.  The equation
would be f(x) = (x - 67) * 255 / (203 - 67).  Important note...
ImageMagick normalizes the brightness value so that it's a floating
point number somewhere between 0 and 1.  The formula will become

convert input_image -fx '(u-67/255)/((203-67)/255)' output_image

This can be simplified to...

convert input_image -fx '(u*255-67)/(203-67)' output_image

And finally to...

convert input_image -fx '(u*255-67)/136' output_image

As a final sanity-check, f(67/255) should be 0 and f(203/255) should be
1.

-- 
Walter Dnes <[EMAIL PROTECTED]> In linux /sbin/init is Job #1
My musings on technology and security at http://tech_sec.blog.ca
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to