Page 1 of 1

TIFF with only a channel and values

Posted: 2012-12-10T03:03:48-07:00
by dayer
Hi,

I'm looking for get a file in TIFF format and only with a channel. Red channel for example, single band, because I'll need for georeference and get pixel values.
Firstly I've replaced the colours by anothers. For example one colour to rgb(12,12,12), another to rgb(18,18,18), rgb(24,24,24), rgb(30,30,30),... And secondly I try to get a TIFF single band with:

Code: Select all

convert prueba.tiff -channel R -separate prueba-R.tiff
But when I check it with gdalinfo it says it's three bands:

Code: Select all

Band 1 Block=480x2 Type=UInt16, ColorInterp=Red
[...]
Band 2 Block=480x2 Type=UInt16, ColorInterp=Green
Band 3 Block=480x2 Type=UInt16, ColorInterp=Blue
And identify -verbose says:

Code: Select all

[...]
  Channel statistics:
    Red:
      min: 3084 (0.0470588)
      max: 65535 (1)
      mean: 62746.7 (0.957453)
      standard deviation: 12821.5 (0.195643)
      kurtosis: 17.2132
      skewness: -4.38243
    Green:
      min: 3084 (0.0470588)
      max: 65535 (1)
      mean: 62746.7 (0.957453)
      standard deviation: 12821.5 (0.195643)
      kurtosis: 17.2132
      skewness: -4.38243
    Blue:
      min: 3084 (0.0470588)
      max: 65535 (1)
      mean: 62746.7 (0.957453)
      standard deviation: 12821.5 (0.195643)
      kurtosis: 17.2132
      skewness: -4.38243
[...]
However, if I try doing this in GIMP, split it in components in layers, delete all layers except Red channel, I get a TIFF only with a band.
gdalinfo says:

Code: Select all

[...]
Band 1 Block=480x64 Type=Byte, ColorInterp=Gray
identify -verbose says:

Code: Select all

[...]
  Channel statistics:
    Gray:
      min: 12 (0.0470588)
      max: 255 (1)
      mean: 244.151 (0.957453)
      standard deviation: 49.8889 (0.195643)
      kurtosis: 17.2132
      skewness: -4.38243
[...]
Then, I try with convert and -type palette and gdalinfo says:

Code: Select all

[...]
Band 1 Block=480x34 Type=Byte, ColorInterp=Palette
  Image Structure Metadata:
    NBITS=4
  Color Table (RGB with 16 entries)
    0: 12,12,12,255
    1: 18,18,18,255
    2: 24,24,24,255
    3: 30,30,30,255
    4: 36,36,36,255
    5: 42,42,42,255
    6: 48,48,48,255
    7: 255,255,255,255
    8: 0,0,0,255
    9: 0,0,0,255
   10: 0,0,0,255
   11: 0,0,0,255
   12: 0,0,0,255
   13: 0,0,0,255
   14: 0,0,0,255
   15: 0,0,0,255
Well. But ¿I could get other values for each pixel? For example:

Code: Select all

    0: 255,255,255
    12: 12,12,12,255
    18: 18,18,18,255
    24: 24,24,24,255
    30: 30,30,30,255
    36: 36,36,36,255
[...]
Thank you very much.

Re: TIFF with only a channel and values

Posted: 2012-12-10T08:01:34-07:00
by snibgo
For me, IM 6.7.9-Q16 on Windows 7:

Code: Select all

convert rose.tiff -channel R -separate rose-r.tiff
gives a greyscale (single channel) file. What version IM and platform are you on?

Re: TIFF with only a channel and values

Posted: 2012-12-10T11:33:43-07:00
by fmw42
In IM 6 any single channel (or grayscale) image will always be 3 equal R,G,B channels. IM 7 will have true single channel images.