DBWritePCT

Demonstrates how to write PCT.

Remarks

The following example illustrates how to handle PCT related operations. Here, we first initialize a PCT to generate a linear gray ramp, then write the PCT to the database, and finally display the segment number created.

Code

  local byte pct[768], int tfid, int i
  local string temp_file

  for i = 1 to 256
    pct[i] = i-1
    pct[i+256] = i-1
    pct[i+512] = i-1
  endfor
  try
    temp_file = "./my.pix"
    delete temp_file noerror
    call CopyFile( GetPCIHOME() + "/demo/irvine.pix", \
                 temp_file)

    tfid = DBOpen(temp_file, "r+")
    call DBWritePCT( tfid, 0, pct )
    call DBClose( tfid )
 onerror
   print "Error: "+ GetLastErrorMessage()
 endonerror

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.