CLUT - Color Lookup Table

Overview

CLUT is a mechanism followed to reduce the size of the image by utilizing the limited colors present in the image. In many cases, the number of colors used in an image or set of images may be less than 256. In that case, rather than using a full 4byte to store the ARGB information, these color values can be placed in a table labelled “Color Lookup Table” (CLUT). Then the colors in the image can be replaced with the index of that color in the CLUT needing only 1 byte of data per pixel. Directly, it could give a 75% reduction in space. Flint supports CLUT mechanism with support of transparent pixel as well. Two types of CLUTs are supported:

  • Self

  • Reference

Self-CLUT

Self and Reference

Self and Reference

If there is only one image is to be converted to a look up 8-bit indexed data, the same can be selected as “CLUT” in Image Format property with CLUT Type as self in the EFP editor. In this case, only a local CLUT table is created and used.

Reference CLUT

If more than one image needs to leverage a common Look up table, this feature can be used where an EFX file can be created to define the CLUT and used as reference in the CLUT Type against the Image property in the EFP.

To create CLUT file in Flint, right click on images ->New -> Project. In the dialog, select Sparklet EFX option. Now select EFX type as CLUT and click Next. Once entered the file name, the EFX file for CLUT is created as below

Creating a CLUT file

To create CLUT file in Flint, right click on images ->New -> Project. In the dialog, select Sparklet EFX option. Now select EFX type as CLUT and click Next. Once entered the file name, the EFX file for CLUT is created as below

EFX-CLUT

EFX-CLUT

There are three ways to add color information to the CLUT – Manual method, from a PNG image or from a GPL Palette file.

Manual Method

EFX-CLUT

EFX-CLUT-1

  • To add color information manually, click the “Add” button in the CLUT table. This action will open a popup window.

  • In the popup window, enter the ARGB values for the color that needs to be added. Additionally, a color picker and preview are available to help choose the desired color.

  • Once entered the ARGB values or selected the color, click “OK” to add it to the CLUT Table.

Adding from PNG or GPL

EFX-CLUT Preview image

EFX-CLUT Preview image

  • To add color information from an image, click on the “Image selection” button. This will open a file selection window.

  • Choose the preferred image file, and it will be displayed in the CLUT editor.

  • After the image is shown in the CLUT editor, press the “Add To CLUT” button. This action will copy all the colors available in the image to the CLUT table displayed at the bottom of the interface.

After adding the colors, the table will look like

EFX-CLUT Table

EFX-CLUT Table

Making Non-CLUT Colors Transparent

  • By enabling the “Make non-CLUT colors Transparent” option, the colors in the image can be made transparent that are not available in the CLUT table.

  • To enable this option, it is necessary to enable the “Consider 0th index as transparent” option as well.

Comment Box

Additionally, a Comment Box has been included in the CLUT to track the image details. By clicking the “Add to CLUT” button, a comment will automatically appear stating that colors have been added from a specific image, like “Added colors from xxx.png.”. In instances when a color is deleted, it is possible to manually append a note within the comment field if considered necessary. This practice serves the purpose of attributing colors to their respective source images. You can also use the comment section to add extra information that might be helpful. Note: Only a maximum of 256 colors can be added to the CLUT table. Flint allows users to delete the colors as needed. Similarly, CLUT can be exported as a GPL file or PNG for use with other external editors.

EFX-CLUT Export format

EFX-CLUT Export format

Note: GPL cannot be exported if the CLUT contains any transparent/semi-transparent colors. In some cases, there might be a requirement to consider the background color of the image as transparent. In this case, there is a checkbox available called “Consider 0th Index as transparent”. Selecting this will replace the first color in the table with a transparent pixel color leading to the necessary effect. It is possible to select any color and move it to the top quickly.