Skip to content

Chroma key

The chroma key feature uses an image overlay. To activate it for the image overlay of the chosen index (0 for the 1st image overlay, 1 for the 2nd, etc.):

  1. Load the background image with SetImageOverlayFromImageFile2 (Index, FileName), or with another SetImageOverlayFrom... function taking the index as the first parameter.
  2. Assign the chroma key RGB color with SetImageOverlay_ChromaKeyRGBColor (Index, Color).
  3. Optionally, adjust the chroma key leeway percentage with SetImageOverlay_ChromaKeyLeewayPercent (Index, Percent). The default value is 25%.
  4. Enable the chroma key with SetImageOverlay_ChromaKey (Index, true).
  5. Enable the image overlay with SetImageOverlay_Enabled (Index, true).

When the chroma key is enabled, the image overlay is stretched to the video size.

Example with the 1st image overlay (index 0):

VideoGrabber.PlayerFileName := 'my video clip.avi';
VideoGrabber.SetImageOverlayFromImageFile2 (0, 'my background image.jpg');
VideoGrabber.SetImageOverlay_ChromaKeyRGBColor (0, $FF0000); // the blue color
VideoGrabber.SetImageOverlay_ChromaKeyLeewayPercent (0, 20); // 20%
VideoGrabber.SetImageOverlay_ChromaKey (0, true);
VideoGrabber.SetImageOverlay_Enabled (0, true);
VideoGrabber.OpenPlayer;

To use several image overlays, see "Applying several image overlays concurrently" in the Image overlays chapter.