Page 1 of 1

Change Palette entries in grayscale raster?

Posted: 2015-08-24T05:30:35-07:00
by Zitterbacke
Hello,
can I change the palette entries in a 4Bit raster (16 colors) with convert.exe from ImageMagick 6.9.1-10 for Windows.

Code: Select all

1 7734brtx_direkt_813dpi.tif
TIFFGetField

 TIFFTags :
o photometric:     1
o samplesperpixel: 1
o bitspersample:   1
o Image Width:     18004
o Image Length:    17004
o Planarconfig:    1
o Rows/Strip:      3
o Resolution:      813.00
o RUnit:           2
o ExtraSamples:    0  0
Here we have known a color index from 0 to 15.

For example I will change the
Color Index 1 from rgb(17,17,17) to rgb(0,0,0)
Color Index 2 from rgb(34,34,34) to rgb(0,0,0)
Color Index 3 from rgb(51,51,51) to rgb(0,0,0)
Color Index 4 from rgb(68,68,68) to rgb(0,0,0)

With IrfanView-GUI, it is possible.

Regards from Munich, Germany.

Re: Change Palette entries in grayscale raster?

Posted: 2015-08-24T21:59:30-07:00
by Zitterbacke
I fond it. It is -threshold value{%}

Re: Change Palette entries in grayscale raster?

Posted: 2015-08-24T22:06:34-07:00
by fmw42
Zitterbacke wrote:I fond it. It is -threshold value{%}
I do not think that will work. It will make all values below your value to black and the rest white.

I think what you want is

Unix syntax:

Code: Select all

convert image \
-fill black -opaque "rgb(17,17,17)"  \
-fill black -opaque "rgb(34,34,34)"  \
-fill black -opaque "rgb(51,51,51)"  \
-fill black -opaque "rgb(68,68,68)"  \
resultimage

Windows syntax:

Code: Select all

convert image ^
-fill black -opaque "rgb(17,17,17)"  ^
-fill black -opaque "rgb(34,34,34)"  ^
-fill black -opaque "rgb(51,51,51)"  ^
-fill black -opaque "rgb(68,68,68)"  ^
resultimage

see
http://www.imagemagick.org/Usage/color_basics/#replace