Illtud Daniel on  wrote...
| Anthony Thyssen wrote:
| 
| > In the mean time you can use a LUT to reduce the number of colors
| > 
| >    http://www.cit.gu.edu.au/~anthony/graphics/imagick6/color/#color_lut
| 
| Thanks - that's really useful. It also pointed me to a simpler way of
| doing it:
| 
| If I have a 256c greyscale image with range 0-255, $image.pgm, then
| this:
| 
| convert -fx 'r/8' -depth 8 image.pgm out.pgm
| 
| gives me the same image but with the levels squashed into 0-31.

but the maxrgb value for the image will still be 256!
only the vlaue will be in 0-31 range!

| However, If I do:
| 
| $image->Fx(expression=>'r/8');
| 
I am not sure.  but remember -fx uses floating point numbers with image
color values from 0 to 1.

Try doing this to 'interize' it

   convert image.pgm -fx 'int(r*8)/8'  -depth 8 out.pgm

Also as you are only greyscaleing the red channel you can speed things
up by only processing the red channel and separting it.

   convert image.pgm -channel R -fx 'int(u*8)/8' \
           -separate -depth 8 out.pgm


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
    Dr Basher: `` Who told you that? ''     Miles O'Brian: `` You did! ''
        `` Well who am I to argue with me!! ''     -- StarTrek DS9, ``Visions''
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to