Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pdl::imagergb(3) [redhat man page]

ImageRGB(3)						User Contributed Perl Documentation					       ImageRGB(3)

NAME
PDL::ImageRGB -- some utility functions for RGB image data handling DESCRIPTION
Collection of a few commonly used routines involved in handling of RGB, palette and grayscale images. Not much more than a start. Should be a good place to exercise some of the thread/map/clump PP stuff. Other stuff that should/could go here: o color space conversion o common image filters o image rebinning SYNOPSIS
use PDL::ImageRGB; FUNCTIONS
cquant quantize and reduce colours in 8-bit images ($out, $lut) = cquant($image [,$ncols]); This function does color reduction for <=8bit displays and accepts 8bit RGB and 8bit palette images. It does this through an interface to the ppm_quant routine from the pbmplus package that implements the median cut routine which intellegently selects the 'best' colors to rep- resent your image on a <= 8bit display (based on the median cut algorithm). Optional args: $ncols sets the maximum nunmber of colours used for the output image (defaults to 256). There are images where a different color reduction scheme gives better results (it seems this is true for images containing large areas with very smoothly changing colours). Returns a list containing the new palette image (type PDL_Byte) and the RGB colormap. interlrgb Make an RGB image from a palette image and its lookup table. $rgb = $palette_im->interlrgb($lut) Input should be of an integer type and the lookup table (3,x,...). Will perform the lookup for any N-dimensional input pdl (i.e. 0D, 1D, 2D, ...). Uses the index command but will not dataflow by default. If you want it to dataflow the dataflow_forward flag must be set in the $lut piddle (you can do that by saying $lut->set_dataflow_f(1)). rgbtogr Converts an RGB image to a grey scale using standard transform $gr = $rgb->rgbtogr Performs a conversion of an RGB input image (3,x,....) to a greyscale image (x,.....) using standard formula: Grey = 0.301 R + 0.586 G + 0.113 B bytescl Scales a pdl into a specified data range (default 0-255) $scale = $im->bytescl([$top]) By default $top=255, otherwise you have to give the desired top value as an argument to "bytescl". Normally "bytescl" doesn't rescale data that fits already in the bounds 0..$top (it only does the type conversion if required). If you want to force it to rescale so that the max of the output is at $top and the min at 0 you give a negative $top value to indicate this. BUGS
This package doesn't yet contain enough useful functions! AUTHOR
Copyright 1997 Christian Soeller <c.soeller@auckland.ac.nz> All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file. perl v5.8.0 2003-01-29 ImageRGB(3)

Check Out this Related Man Page

rgb2pct(1)						      General Commands Manual							rgb2pct(1)

NAME
rgb2pct - rgb2pct.py Convert a 24bit RGB image to 8bit paletted SYNOPSIS
rgb2pct.py [-n colors | -pct palette_file] [-of format] source_file dest_file DESCRIPTION
This utility will compute an optimal pseudo-color table for a given RGB image using a median cut algorithm on a downsampled RGB histogram. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality. -n colors: Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256. -pct palette_file: Extract the color table from palette_file instead of computing it. Can be used to have a consistant color table for multiple files. The palette_file must be a raster file in a GDAL supported format with a palette. -of format: Format to generated (defaults to GeoTIFF). Same semantics as the -of flag for gdal_translate. Only output formats supporting pseudocolor tables should be used. source_file: The input RGB file. dest_file: The output pseudo-colored file that will be created. NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support. EXAMPLE
If it is desired to hand create the palette, likely the simpliest text format is the GDAL VRT format. In the following example a VRT was created in a text editor with a small 4 color palette with the RGBA colors 238/238/238/255, 237/237/237/255, 236/236/236/255 and 229/229/229/255. % rgb2pct.py -pct palette.vrt rgb.tif pseudo-colored.tif % more < palette.vrt <VRTDataset rasterXSize="226" rasterYSize="271"> <VRTRasterBand dataType="Byte" band="1"> <ColorInterp>Palette</ColorInterp> <ColorTable> <Entry c1="238" c2="238" c3="238" c4="255"/> <Entry c1="237" c2="237" c3="237" c4="255"/> <Entry c1="236" c2="236" c3="236" c4="255"/> <Entry c1="229" c2="229" c3="229" c4="255"/> </ColorTable> </VRTRasterBand> </VRTDataset> AUTHOR
Frank Warmerdam warmerdam@pobox.com GDAL
Tue Sep 18 2012 rgb2pct(1)
Man Page