Home / YUVTools / YUV Composition

YUV Composition:

When you have two YUV image files, and like to put one image on top of another, this is the function you will need.

The two image files, called the based image file and the top image file  respectively , have to be in the exactly same format, except for the image resolution. One exception is that the top image file can also be a BMP file.

The composed image file will always have the same or less number of frames as the base file. You can select which frame in the base file to start, and which frame to end the composition process. For example, if the base file has 90 frames in total, you can select to start at frame 20, and end at frame 60. Then the composed file will have 41 frames, and first 19 frames and last 30 frames in the base file will not be used.

The top image will always start with the first frame. In the case the top file has more frames, the rest of frames will not be used. If top image file has less frames than (end_frame - start_frame +1), then you can specify whether you need to repeat the last frame in the top image, to continue to put on top of the rest frames of the base file.

To start compose two image files, click on "YUVEditor" from the main menu, then select "Composition", or simply click on from the toolbar. 

              (Click on above image to display a full resolution image)

After you select the base image file and the top image file, the program will automatically fill in the file name for the composed file, or you can rename it as you like. You also need to specify the position of top image's top-left corner. For example, the top image can start with left column 20 and top line of 10 inside the base image. Click on "Start", you will see the two images are composed together, as shown above.

The top image can also be BMP file(s). When the top image is BMP file, the base image file can be in any format. Here is an example

              (Click on above image to display a full resolution image)

Another parameter for the composition is the transparency percentage. You can make the top image transparent during the composition process. By default, transparency percentage is 0, which mean no transparent. Value 100 means completely transparent. Here is the example with the percentage set to 58:

              (Click on above image to display a full resolution image)

If you like to exclude some pixels in the top image from the composition, you can enable the color key, and select one color (in RGB) as the color key. Any pixels in the top image match this color will be skipped and will not be put onto the base image, like: 

              (Click on above image to display a full resolution image)

As you can notice, some pixels around the text edges do not match the color key exactly, and will be overlaid on top of the base image. This will generate certain artifacts in the composed image. In order to remove the edges around the text, you can specify a tolerance range for the color match. When the program compares each pixel's RGB value with the color key, if:

ABS(Pixel_R - ColorKey_R) <= colorkey_tolerance &&
ABS(Pixel_G - ColorKey_G) <= colorkey_tolerance &&
ABS(Pixel_B - ColorKey_B) <= colorkey_tolerance

Then the pixel will be skipped from the composition. Here is an example:

              (Click on above image to display a full resolution image)

Copyright, www.sunrayimage.com, 2009