[gdal-dev] problem with make a color transparent [-n nodata value]

Jan Tappenbeck tappenbeck at widemann.de
Fri Dec 4 03:39:33 EST 2009


Hallo !

i want to make a white-border of a tif-image transparent for merge in 
the next steps.

in photoshop a analyst the color like 255,255,255 => color-index 255.

the image to edit is:

Driver: GTiff/GeoTIFF
Files: C:\temp\Nordfriesland\L1516l0.tif
       C:\temp\Nordfriesland\L1516l0.tfw
Size is 8845, 9119
Coordinate System is `'
Origin = (3456524.965278996600000,6052507.832452093300000)
Pixel Size = (2.500185047310530,-2.500185047310530)
Metadata:
  TIFFTAG_SOFTWARE=WGEO 5.0 LVA_SH
  TIFFTAG_DATETIME=2007/11/19 11:58:59
  TIFFTAG_XRESOLUTION=508
  TIFFTAG_YRESOLUTION=508
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 3456524.965, 6052507.832)
Lower Left  ( 3456524.965, 6029708.645)
Upper Right ( 3478639.102, 6052507.832)
Lower Right ( 3478639.102, 6029708.645)
Center      ( 3467582.034, 6041108.239)
Band 1 Block=8845x1 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 255,255,255,255
    1: 0,0,0,255
    2: 0,0,255,255
    3: 204,255,255,255
    4: 178,102,0,255
    5: 204,255,204,255
    6: 211,211,211,255
    7: 242,214,170,255
    8: 0,229,0,255
    9: 255,242,89,255
   10: 255,89,89,255
   11: 102,51,0,255
   12: 178,216,255,255
   13: 255,89,89,255
   14: 255,178,178,255
   15: 204,102,216,255
   16: 229,204,242,255
   17: 216,153,216,255
   18: 114,165,89,255
   19: 216,255,178,255
   20: 255,255,255,255
   21: 255,255,204,255
   22: 255,242,153,255
   23: 255,216,38,255
   24: 255,196,0,255
   25: 255,178,0,255
   26: 216,165,99,255
   27: 130,0,63,255
   28: 255,119,104,255
   29: 255,196,0,255
   30: 216,255,178,255
   31: 178,234,127,255
   32: 255,127,0,255
   33: 255,242,119,255
   34: 255,255,255,255
   35: 204,219,165,255
   36: 255,255,255,255
   37: 255,255,255,255
   38: 255,255,255,255
   39: 255,255,255,255
   40: 255,255,255,255
   41: 255,255,255,255
   42: 255,255,255,255
   43: 255,255,255,255
   44: 255,255,255,255
   45: 255,255,255,255
   46: 255,255,255,255
   47: 255,255,255,255
   48: 255,255,255,255
   49: 255,255,255,255
   50: 255,255,255,255
   51: 255,255,255,255
   52: 255,255,255,255
   53: 255,255,255,255
   54: 255,255,255,255
   55: 255,255,255,255
   56: 255,255,255,255
   57: 255,255,255,255
   58: 255,255,255,255
   59: 255,255,255,255
   60: 255,255,255,255
   61: 255,255,255,255
   62: 255,255,255,255
   63: 255,255,255,255
   64: 255,255,255,255
   65: 255,255,255,255
   66: 255,255,255,255
   67: 255,255,255,255
   68: 255,255,255,255
   69: 255,255,255,255
   70: 255,255,255,255
   71: 255,255,255,255
   72: 255,255,255,255
   73: 255,255,255,255
   74: 255,255,255,255
   75: 255,255,255,255
   76: 255,255,255,255
   77: 255,255,255,255
   78: 255,255,255,255
   79: 255,255,255,255
   80: 255,255,255,255
   81: 255,255,255,255
   82: 255,255,255,255
   83: 255,255,255,255
   84: 255,255,255,255
   85: 255,255,255,255
   86: 255,255,255,255
   87: 255,255,255,255
   88: 255,255,255,255
   89: 255,255,255,255
   90: 255,255,255,255
   91: 255,255,255,255
   92: 255,255,255,255
   93: 255,255,255,255
   94: 255,255,255,255
   95: 255,255,255,255
   96: 255,255,255,255
   97: 255,255,255,255
   98: 255,255,255,255
   99: 255,255,255,255
  100: 255,255,255,255
  101: 255,255,255,255
  102: 255,255,255,255
  103: 255,255,255,255
  104: 255,255,255,255
  105: 255,255,255,255
  106: 255,255,255,255
  107: 255,255,255,255
  108: 255,255,255,255
  109: 255,255,255,255
  110: 255,255,255,255
  111: 255,255,255,255
  112: 255,255,255,255
  113: 255,255,255,255
  114: 255,255,255,255
  115: 255,255,255,255
  116: 255,255,255,255
  117: 255,255,255,255
  118: 255,255,255,255
  119: 255,255,255,255
  120: 255,255,255,255
  121: 255,255,255,255
  122: 255,255,255,255
  123: 255,255,255,255
  124: 255,255,255,255
  125: 255,255,255,255
  126: 255,255,255,255
  127: 255,255,255,255
  128: 255,255,255,255
  129: 255,255,255,255
  130: 255,255,255,255
  131: 255,255,255,255
  132: 255,255,255,255
  133: 255,255,255,255
  134: 255,255,255,255
  135: 255,255,255,255
  136: 255,255,255,255
  137: 255,255,255,255
  138: 255,255,255,255
  139: 255,255,255,255
  140: 255,255,255,255
  141: 255,255,255,255
  142: 255,255,255,255
  143: 255,255,255,255
  144: 255,255,255,255
  145: 255,255,255,255
  146: 255,255,255,255
  147: 255,255,255,255
  148: 255,255,255,255
  149: 255,255,255,255
  150: 255,255,255,255
  151: 255,255,255,255
  152: 255,255,255,255
  153: 255,255,255,255
  154: 255,255,255,255
  155: 255,255,255,255
  156: 255,255,255,255
  157: 255,255,255,255
  158: 255,255,255,255
  159: 255,255,255,255
  160: 255,255,255,255
  161: 255,255,255,255
  162: 255,255,255,255
  163: 255,255,255,255
  164: 255,255,255,255
  165: 255,255,255,255
  166: 255,255,255,255
  167: 255,255,255,255
  168: 255,255,255,255
  169: 255,255,255,255
  170: 255,255,255,255
  171: 255,255,255,255
  172: 255,255,255,255
  173: 255,255,255,255
  174: 255,255,255,255
  175: 255,255,255,255
  176: 255,255,255,255
  177: 255,255,255,255
  178: 255,255,255,255
  179: 255,255,255,255
  180: 255,255,255,255
  181: 255,255,255,255
  182: 255,255,255,255
  183: 255,255,255,255
  184: 255,255,255,255
  185: 255,255,255,255
  186: 255,255,255,255
  187: 255,255,255,255
  188: 255,255,255,255
  189: 255,255,255,255
  190: 255,255,255,255
  191: 255,255,255,255
  192: 255,255,255,255
  193: 255,255,255,255
  194: 255,255,255,255
  195: 255,255,255,255
  196: 255,255,255,255
  197: 255,255,255,255
  198: 255,255,255,255
  199: 255,255,255,255
  200: 255,255,255,255
  201: 255,255,255,255
  202: 255,255,255,255
  203: 255,255,255,255
  204: 255,255,255,255
  205: 255,255,255,255
  206: 255,255,255,255
  207: 255,255,255,255
  208: 255,255,255,255
  209: 255,255,255,255
  210: 255,255,255,255
  211: 255,255,255,255
  212: 255,255,255,255
  213: 255,255,255,255
  214: 255,255,255,255
  215: 255,255,255,255
  216: 255,255,255,255
  217: 255,255,255,255
  218: 255,255,255,255
  219: 255,255,255,255
  220: 255,255,255,255
  221: 255,255,255,255
  222: 255,255,255,255
  223: 255,255,255,255
  224: 255,255,255,255
  225: 255,255,255,255
  226: 255,255,255,255
  227: 255,255,255,255
  228: 255,255,255,255
  229: 255,255,255,255
  230: 255,255,255,255
  231: 255,255,255,255
  232: 255,255,255,255
  233: 255,255,255,255
  234: 255,255,255,255
  235: 255,255,255,255
  236: 255,255,255,255
  237: 255,255,255,255
  238: 255,255,255,255
  239: 255,255,255,255
  240: 255,255,255,255
  241: 255,255,255,255
  242: 255,255,255,255
  243: 255,255,255,255
  244: 255,255,255,255
  245: 255,255,255,255
  246: 255,255,255,255
  247: 255,255,255,255
  248: 255,255,255,255
  249: 255,255,255,255
  250: 255,255,255,255
  251: 255,255,255,255
  252: 255,255,255,255
  253: 255,255,255,255
  254: 255,255,255,255
  255: 255,255,255,255

now i start follwing command:

gdal_merge -v -o c:\temp\Nordfriesland\outputfile.tif -of GTiff -ps 1 1 
-pct -co COMPRESS=LZW -n 255 C:\temp\Nordfriesland\L1516l0.tif

and i became this error message:
Filename: C:\temp\Nordfriesland\L1516l0.tif
File Size: 8845x9119x1
Pixel Size: 2.500185 x -2.500185
UL:(3456524.965279,6052507.832452)   LR:(3478639.102022,6029708.645006)
Copy 0,0,8845,9119 to 246,0,22115,22799.
Traceback (most recent call last):
  File "C:\PROGRA~1\FWTOOL~1.6\bin\gdal_merge.py", line 434, in ?
    fi.copy_into( t_fh, band, band, nodata )
  File "C:\PROGRA~1\FWTOOL~1.6\bin\gdal_merge.py", line 228, in copy_into
    nodata_arg )
  File "C:\PROGRA~1\FWTOOL~1.6\bin\gdal_merge.py", line 48, in raster_copy
    nodata )
  File "C:\PROGRA~1\FWTOOL~1.6\bin\gdal_merge.py", line 85, in 
raster_copy_with_
nodata
    data_dst = t_band.ReadAsArray( t_xoff, t_yoff, t_xsize, t_ysize )
  File "C:\PROGRA~1\FWTOOL~1.6\pymod\gdal.py", line 877, in ReadAsArray
    buf_xsize, buf_ysize, buf_obj )
  File "C:\PROGRA~1\FWTOOL~1.6\pymod\gdalnumeric.py", line 178, in 
BandReadAsArr
ay
    buf_obj = zeros( shape, typecode )
MemoryError: can't allocate memory for array

did anybody had more informations for the reasons ????

regards Jan :-)



More information about the gdal-dev mailing list