The FXScript Reference

For Final Cut Pro created by Joe Maller

Invert

Invert(srcImage, destImage)

Additional Notes

YUV problems and slow

I've had problems using Invert with YUV scripts, InvertChannel worked perfectly. Invert is also nearly twice as fast as InvertChannel

YUV Invert bug proof script

This script will demonstrate the problems and speed differences between Invert and InvertChannel:


filter "Invert YUV test"
Group "FXScript Reference";

input inverter, "Invert Method", RadioGroup, 1, "Invert()", "InvertChannel()";

InformationFlag("YUVaware");

code

float colorspace, w, h;
dimensionsof(dest, w, h);
image xbuffer[w][h];

colorSpace = GetPixelFormat(dest);    

dest = src1;

if GetPixelFormat(dest) != kFormatYUV219;
    ConvertImage(src1, dest, kFormatYUV219);
    setPixelFormat(xbuffer, kFormatYUV219);
end if

if inverter == 1
    invert(dest, xbuffer);
else
    invertchannel(dest, xbuffer, 0, 1, 1, 1);
end if

if colorSpace != GetPixelFormat(dest)
    ConvertImage(xbuffer, dest, colorspace);
else
    dest = xbuffer;
end if