[gdal-dev] gdal_merge.py -separate failing to create RGB

mattia mattia.parigiani at gmail.com
Wed Apr 2 10:04:46 EDT 2008


I do get something now and the bands are geting filled but the output image
looses way too much detail...
It is all white basically with some blue, yellow and red patterns here and
there.. very strange ...

here is the gdalinfo:

Driver: GTiff/GeoTIFF
Files: out2.tif
Size is 2708, 9340
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 9340.0)
Upper Right ( 2708.0,    0.0)
Lower Right ( 2708.0, 9340.0)
Center      ( 1354.0, 4670.0)
Band 1 Block=2708x1 Type=Byte, ColorInterp=Red
Band 2 Block=2708x1 Type=Byte, ColorInterp=Green
Band 3 Block=2708x1 Type=Byte, ColorInterp=Blue


I have a feeling that it is actually the gdal_merge.py utility that does not
work with 16 bit integer images

The following explains my conclusion; if I extract my band greyscale images
with the following command:

*gdal_translate -ot Byte -scale -co "INTERLEAVE=BAND" -b 1
HDF4_SDS:UNKNOWN:"AMOD02HKM20070104021601.hdf":0 b1.tif

*And the same for bands 2 and 3 for example

I get a downscale from 16 bit to 8 bit integers...

If I now call gdal_merge.py on these 3 bands, I get a proper RGB image


But,

If I do the band extraction with :

*gdal_translate -co "INTERLEAVE=BAND" -b 1
HDF4_SDS:UNKNOWN:"AMOD02HKM20070104021601.hdf":0 b1.tif*


ie: not downscaling and leaving the pixel sizes as 16 bit integers.. Then I
try merging, I dont get any RGB image...

Is my conclusion right?










On Wed, Apr 2, 2008 at 9:25 AM, Lucena, Ivan <ivan.lucena at pmldnet.com>
wrote:

> Hi Mattia,
>
> > * gdal_merge.py -separate t1.tif t2.tif t3.tif -o out.tif*
>
> Have you tried to use [-ot datatype] to enforce changing the data type to
> byte?
>
> Just a thought.
>
> Ivan
>
> mattia wrote:
>
> > Hi folks,
> >
> > I have a problem trying to create RGBs with the gdal_merge.py utility...
> >
> > Mainly I have some images that I have extracted from HDF4 SDSs and
> > processed
> > in TIFF format using ImageMagick...
> >
> > Now a sample image as the following gdalinfo output:
> >
> > *mattia at mattia-laptop:~/Desktop/rgb$ gdalinfo t2.tif
> > Driver: GTiff/GeoTIFF
> > Files: t2.tif
> > Size is 2708, 9340
> > Coordinate System is `'
> > Metadata:
> >  TIFFTAG_DOCUMENTNAME=AMOD02HKM20070104021601_0_1_band_2_out.tif
> >  TIFFTAG_SOFTWARE=ImageMagick 6.3.8 02/18/08 Q16
> > http://www.imagemagick.org
> >  TIFFTAG_XRESOLUTION=72
> >  TIFFTAG_YRESOLUTION=72
> >  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> > Image Structure Metadata:
> >  INTERLEAVE=BAND
> > Corner Coordinates:
> > Upper Left  (    0.0,    0.0)
> > Lower Left  (    0.0, 9340.0)
> > Upper Right ( 2708.0,    0.0)
> > Lower Right ( 2708.0, 9340.0)
> > Center      ( 1354.0, 4670.0)
> > Band 1 Block=2708x1 Type=UInt16, ColorInterp=Gray*
> >
> > The file size (for the three images I am trying to merge) is about
> > 50MB..
> > As you can see its a 16 bit image..
> >
> > if I run something like:
> >
> > * gdal_merge.py -separate t1.tif t2.tif t3.tif -o out.tif*
> >
> > The output image out.tif is still a greyscale where 2 of the bands are
> > somehow "not recognized"...
> > The gdalinfo on the output tif is:
> >
> > *Driver: GTiff/GeoTIFF
> > Files: out.tif
> > Size is 2708, 9340
> > Coordinate System is `'
> > Image Structure Metadata:
> >  INTERLEAVE=PIXEL
> > Corner Coordinates:
> > Upper Left  (    0.0,    0.0)
> > Lower Left  (    0.0, 9340.0)
> > Upper Right ( 2708.0,    0.0)
> > Lower Right ( 2708.0, 9340.0)
> > Center      ( 1354.0, 4670.0)
> > Band 1 Block=2708x1 Type=UInt16, ColorInterp=Gray
> > Band 2 Block=2708x1 Type=UInt16, ColorInterp=Undefined
> > Band 3 Block=2708x1 Type=UInt16, ColorInterp=Undefined
> > *
> >
> > Does it have to do with the fact that its a 16 bit image and
> > gdal_merge.py
> > doesn't support it?
> > With the fact that ImageMagick has corrupted something ?
> > Or what exactly is the issue?
> >
> > Thanks in advance
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
>


-- 
Mattia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080402/b21bd1dc/attachment.html


More information about the gdal-dev mailing list