
Contents |
Image Palette
Apply palette to image
1. imgPalette palfile:=system.path.program$+"Palettes\green.pal";
2. imgPalette palfile:=system.path.program$+"Palettes\rainbow.pal" oimg:=mat(2);
| Display Name | Variable Name | I/O and Type | Default Value | Description |
|---|---|---|---|---|
| Input Matrix | img |
Input Image | |
Specifies the source image to be manipulated. The default input is the active image. |
| Palette File | palfile |
Input string | |
Specifies the palette file to use. |
| Output Image | oimg |
Output Image | |
Specifies the output image. By default, the output image is the same as the input image. See the syntax here. |
The imgPalette function applies a palette to an 8-bit grayscale image. By doing this, we are actually applying pseudocolor to the grayscale image, where the palette file is used as the pseudocolor lookup table.
This X-Function works with 8-bit grayscale images only. If the image to be processed does not meet this requirement, you will have to convert it to an 8-bit grayscale image first. In Origin, you can use the imgC2gray X-Function to perform the conversion.
Note that some built-in palette files are saved in Palettes subfolder of the Origin 8 program folder.
In this example, we use the imgPalette function to apply pseudocolor to a grayscale image:

For more examples, please refer to XF Script Dialog (press F11).
The gray levels of the original image are mapped to different colors according to the palette file.
Kenneth R.Castleman.1996. Digital Image Processing. Prentice Hall, Upper Saddle River, NJ, USA.