< Previous | Contents | Next >

YUV.Y, YUV.U, YUV.V

YUV colorspace channels

Example


This example would copy the RGBA channels in the foreground image to the background and return the results to img_out.

img_out = img:ChannelOpOf("Copy", img_fg, { R = "Fg.R", G = "Fg.G", B = "Fg.B", A = "Fg.A" } )


This example would subtract foreground’s RGBA channels from the background and return the results to img_out.

img_out = img:ChannelOpOf("Subtract", img_fg, { R = "Fg.R", G = "Fg.G", B

= "Fg.B", A = "Fg.A" } )


This example would Add the R, G and B of image_bg to the R, G and B of image_fg, returning the results to img_out.

img_out = img_bg:ChannelOpOf("Add", img_fg, { R = "Fg.R", G = "Fg.G", B

= "Fg.B", A = "Fg.A" })


This example would multiply every pixel in img_bg by the value of blend (in this case 0.5) and return the results to img_out.

blend = 0.5

img_out = img_bg:ChannelOpOf("Multiply", nil, { R = blend, G = blend, B

= blend, A = blend })

This example would clip every pixel in img_bg outside the range of 0.2

.. 0.8, scale the remaining pixels to the range of 0 .. 1 and return the results to img_out.

blend = 0.5

out = bg:ChannelOpOf("Threshold", nil, { R = "bg.r", G = "bg.g", B = "bg.b", A = "bg.a" }, 0.2, 0.8)


This will copy the alpha from the foreground image to the background output image

img = img:ChannelOpOf("Copy", img_fg, {A = fg.A})


This will not affect the RGB channels and on multiply alpha

img = img:ChannelOpOf("Multiply", nil, {R = nil, G = nil, B = nil, A = gain})