ImageEn, unit imageenproc

TImageEnProc.MapGrayToColor

TImageEnProc.MapGrayToColor


Declaration

procedure MapGrayToColor(map: array of TRGB);


Description

Map each gray scale level to specified RGB color using the provided map.

Parameter Description
map Array of 256 elements of TRGB values

Note:
You can generate 256 color maps using GenerateDicomColorPalette, GenerateColorLuminancePalette, GenerateHuePalette and GenerateGradientPalette
To display images with a color map (without modifying the image) use AssignColorMap
Color to gray conversion is controlled by: RedToGrayCoef, GreenToGrayCoef, BlueToGrayCoef
If the image PixelFormat is not ie24RGB, it will be converted


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Method Testing

ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Apply a gradient palette to image
colorMap := GenerateGradientPalette( clYellow, clGreen, 256 );
ImageEnView1.Proc.MapGrayToColor(colorMap);

  

// Apply HotMetalBlue palette to image
colorMap := GenerateDicomColorPalette( iectHotMetalBlue );
ImageEnView1.Proc.MapGrayToColor(colorMap);

  


Examples

var
  map: array [0..255] of TRGB;
  i: Integer;
begin
  for i := 0 to 255 do
  begin
    map[i].r := i;
    map[i].g := 255-i;
    map[i].b := i;
  end;
  ImageEnView1.IO.LoadFromFile('grayimage.jpg');
  ImageEnView1.Proc.MapGrayToColor(map);
end;

// Apply Rainbow palette to image
colorMap := GenerateDicomColorPalette( iectRainbow );
ImageEnView1.Proc.MapGrayToColor(colorMap);




// Apply Hot Iron palette to image
colorMap := GenerateDicomColorPalette( iectHotIron );
ImageEnView1.Proc.MapGrayToColor(colorMap);




// Apply PET palette to image
colorMap := GenerateDicomColorPalette( iectPET );
ImageEnView1.Proc.MapGrayToColor(colorMap);




// Apply PET 20 Step palette to image
colorMap := GenerateDicomColorPalette( iectPET20Step );
ImageEnView1.Proc.MapGrayToColor(colorMap);




// Apply Hot Metal Blue palette to image
colorMap := GenerateDicomColorPalette( iectHotMetalBlue );
ImageEnView1.Proc.MapGrayToColor(colorMap);




See Also

GenerateDicomColorPalette
GenerateColorLuminancePalette
GenerateHuePalette
GenerateGradientPalette