| PictureEffects REALbasic Plugin |
|
CreateChromaKeyMask Method
Creates a mask by using a Chroma Key algorithm. Chroma Key algorithms are to mask out special background material which can be either green or blue. Only Green is supported currently.
CreateChromaKeyMask(
src as Picture,
baseLevel as Double,
shadowThreshold as Double,
mask as Picture,
progress as IProgressHandler) as Picture
Parameters
- src
- The source picture to work with (can be 24 or 32 bits).
- baseLevel
- Sets the base level of the Green Chroma color, 0.0 is for very greenish Chroma background and when going towards 1.0 then it will work on more green-yellowish chroma backgrounds. (The range of this parameter is from 0.0 to 1.0).
- shadowThreshold
- The threshold of shadow levels. This value should be from 0.0 to 1.0. If doing a Chroma Keying without any user interaction then leave this value at 0.0 or 0.39 at most.
- mask
- To limit the filtering to certain pixels then set a picture defining the mask to this parameter. Pass nil to this parameter if the filtering should not be limited to certain pixels.
The mask picture must be a 32 bit picture and must be same size as the src picture. If the mask picture is not 32 bits and same size as the src picture then the function will fail and leave the result picture unchanged. - progress
- Use this parameter to use a progress class to get progress feedback from this function. This class must be a class that Implements the IProgressHandler Interface which is defined in this plugin.
Pass nil to this parameter if you don't need progress feedback.
Progress feedback will slow the filter down.
Returns
- Picture
- Returns a 32 bit Grayscale Mask.
If the src picture was not 24 or 32 bits then a nil will be returned.
Nil is also returned if the shadowThreshold parameter is out of range.
Remarks

Sometimes it will make sense to use a Blur Filter to soften edges of the returned mask.
If you have examples of images that are fit for Blue Chroma Key masking then by all means feel free to send us examples of them and we will at least try to implement support for blue.
Supported Platforms:
PPC - MacOS 9Carbon - MacOS 9 and MacOS X (PEF)MacOS X PPC - (Mach-O)MacOS X Universal Binary (Mach-O)Win32 - WindowsLinux x86
See Also
GlobalMethods Global