This capability is useful when colour images have to be exported to other hardware/software systems which do not have 24-bit colour support.
The ADAPT and PCTMAKE programs are similar, but compute PCTs better adapted to a particular image. Then the ERRDIFF or RGB2PCT programs can be used to convert the RGB images to one channel.
Progress of this program can be monitored. See MONITOR section.
See Also: PCXWRIT, PCTWRIT, PCTMAKE, RGB2PCT, ERRDIFF, ADAPT
Name Prompt Count Type FILE Database File Name 1-64 Char DBIC Database Input Channel List 3 Int DBLUT Database Lookup Table Segment 0-3 Int DBOC Database Output Channel List 1 Int RGBLEVEL Output Compression Levels: R,G,B 3 Int DBPCT Database Pseudocolour Segment 0-1 Int DBSN Database Segment name 0-8 Char DBSD Database Segment Descriptor 0-64 Char The following parameter receives output: DBPCT Database Pseudocolour Segment 0-1 Int
EASI>FILE="filespec"
EASI>DBIC=r,g,b
EASI>DBLUT=i,j,k | use LUTs to enhance EASI>DBLUT= | no enhancement, use raw RGB
EASI>DBOC=i
EASI>RGBLEVEL=redlevels,greenlevels,bluelevelsThe following are typical settings:
EASI>RGBLEVEL=6,6,6 | total 216 values EASI>RGBLEVEL=5,9,5 | total 225 values EASI>RGBLEVEL=7,7,5 | total 245 values
EASI>DBPCT=n | overwrite PCT segment n EASI>DBPCT= | create a new segmentIf a new segment is created then DBPCT is updated with the created segment number when the program completes.
EASI>DBSN="string"This value is only used if a new pseudocolour table segment is created.
EASI>DBSD="string"This value is only used if a new pseudocolour table segment is created.
The input file (FILE) contains the input RGB channels (DBIC) and the channel to which to write the compressed result (DBOC). An enhancement can be applied to the RGB channels by the use of previously saved lookup tables (DBLUT) held in segments on the input file. The generated PCT is saved in a segment on the input file. This can either overwrite an existing PCT or a new segment can be created (DBPCT). If a new segment is created then an 8-character identifying name (DBSN) and a 64-character descriptor (DBSD) are assigned to it.
A value of black (0,0,0) is assigned to entries in the PCT for which the respective image values are not required in the compression.
The input RGB channels and the output compressed channel should be 8-bit. This restriction is due to the 8-bit nature of a pseudocolour table. While any type of image channel can be used, values are internally converted to 8-bit data. Using non 8-bit data may result in unexpected or poor results.
CMPRSS8 is not intended for compressing Black and White imagery.
EASI>MONITOR="ON" | turn monitor ON (default)
EASI>MONITOR="OFF" | turn monitor OFF (recommended if
| running in batch/background mode)
Each colour band is reduced from 256 grey levels to the number of grey levels specified in the RGBLEVEL parameter. Typically this is 10 or less. The generated pseudocolour table maps each of these new grey levels onto a reasonable intensity representing all the original grey levels. For example, suppose the number of output grey levels is 4 for a channel, then:
input grey levels output level intensity
0 - 63 0 0
64 - 128 1 85
129 - 192 2 170
193 - 255 3 255
The output intensities always span 0 to 255 to ensure that the
greatest dynamic range of colours is used. Using the mid point of
each range (say 32 rather than 0) may be more faithful but doesn't
look as good.Once the grey levels have been reduce and the output intensities for each colour determined, the values are encoded into a single 8-bit image channel and corresponding pseudocolour table. The following code fragments show this algorithm.
Image Compression
for each pixel
newred = integer((redPixel *redLevels) / 256)
newgreen = integer((greenPixel*greenLevels)/ 256)
newblue = integer((bluePixel *blueLevels) / 256)
encodedPixel = newred + newgreen*redLevels
+ newblue *redLevels*greenLevels
endfor
Pseudocolour Table Generation
i = 0
for blue = 0,bluelevels-1
blueIntensity = (blue*255) / (blueLevels-1)
for green = 0,greenLevels-1
greenIntensity = (green*255) / (greenLevels-1)
for red = 0,redLevels-1
redIntensity = (red*255) / (redLevels-1)
PCT[i] = redIntensity, greenIntensity, blueIntensity
i = i + 1
endfor
endfor
endfor
To print out the results of these calculations on actual data, use
the programs NUM and PCTREP.
EASI>FILE = "irvine.pix" EASI>DBIC = 3,2,1 EASI>DBLUT= 4,3,2 EASI>DBOC = 7 EASI>RGBLEVEL = 5,8,5 EASI>DBPCT= | will contain new segment # EASI>DBSN = "RGB8bit" EASI>DBSD = "RGB for 8-bit compression" EASI>RUN CMPRSS8The 8-bit image is now made into a SUN Rasterfile.
EASI>FILI = FILE | irvine.pix EASI>FILO = "irvine.im8" EASI>DBIC = DBOC | 7 EASI>DBIW = EASI>DBLUT= EASI>FTYPE="SUN" EASI>RUN FEXPORTThe file irvine.im8 can now be used by the GIS system.