The function you want is called -contrast-stretch. You can provide percentile values to clip either end of the histogram and then it stretches the histogram and image linearly between those values converted to graylevels. You can stretch the image channels together or separately. The latter is done by using -channels rgb prior to -contrast-stretch.
To stretch the image linearly and all channels together by 1% on the low side and 1% (at the 99% percent) on the high side, it would be convert image -contrast-stretch 1,1% resultimage see http://www.imagemagick.org/Usage/color_mods/#contrast-stretch http://www.imagemagick.org/script/command-line-options.php?ImageMagick=4dk567trius4djjoe7fimpst40#contrast-stretch Fred >Thanks a lot Fred. I will check the options you have suggested. > >I want to calculate 99th percentile value of the image and the 1st >percentile of the image using the pixels and use these percentiles to level >the image using black, white, and gamma. I will use 99th percentile as >black, 1st percentile as white and gamma =1. > >Do you know about any alternative method which can do this ? > >Please let me know, >Thanks, >Shameer > _______________________________________________ Magick-users mailing list Magick-users@imagemagick.org http://studio.imagemagick.org/mailman/listinfo/magick-users