[Gdal-dev] Re: [GRASS5] export RGB channels in one ERDAS/IMG file

Frank Warmerdam warmerdam at pobox.com
Wed Sep 29 13:31:36 EDT 2004


Otto Dassau wrote:

> ###ERROR:
> gdal_merge.py -v -of HFA 1.img -separate 1b.img 1g.img 1r.img 
> 
> Filename: 1.img
> File Size: 31476x31818x3
> Pixel Size: 0.320000 x -0.320000
> UL:(3367943.360000,5941153.600000)   LR:(3378015.680000,5930971.840000)
> Copy 0,0,31476,31818 to 0,0,31476,31818.
> ERROR 1: 1.img:0: Invalid strip byte count, strip 0
> ERROR 1: TIFFReadEncodedStrip() failed.
> 
> ERROR 1: IReadBlock failed at X offset 0, Y offset 0
> ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0
> Traceback (most recent call last):
>   File "/usr/local/bin/gdal_merge.py", line 439, in ?
>     fi.copy_into( t_fh, 1, t_band, nodata )
>   File "/usr/local/bin/gdal_merge.py", line 268, in copy_into
>     nodata_arg )
>   File "/usr/local/bin/gdal_merge.py", line 101, in raster_copy
>     t_xsize, t_ysize, t_band.DataType )
>   File "/usr/lib/python2.3/site-packages/gdal.py", line 690, in ReadRaster
>     buf_xsize, buf_ysize,buf_type)
> TypeError: GetBlockRef failed at X block offset 0, Y block offset 0
> 
> Why is there a problem with TIFF, although I export to ERDAS? 

Otto,

I don't know why.  How sure are you that 1g.img, 1r.img and 1b.img are
really imagine files?  I would verify this with gdalinfo.

BTW, I think you need to use the -o flag otherwise output goes to
out.tif.  So try:

   gdal_merge.py -v -of HFA -o 1.img -separate 1b.img 1g.img 1r.img

If problems persist you will need to give us more information.  Does
gdal_merge.py work with only one input file (try each)?  etc.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list