Knowledge Base

KB10394 - Set transparent pixel color value(s) in an image layer.

Pixels of a specific color or zone (range) of colors in an image layer can be rendered transparent. The result is all pixels matching the color or color zone definition will not be visible. The color true black, for example, can be defined with the code '000000'. A color zone can be defined by a starting and ending color value. For example, a range of colors near to true black might be defined with '000000 - 050505'. Multiple pixel color zones in an image can be defined.

The procedure is use Notepad to create a text file named your_file_name.ext.ini. The text file name must have the proper file type extension, such as *.tif.ini for a tif image file or *.ttkps.ini for a PixelStore image file. Place content like shown in the examples below in the text file and place the text file in the same folder together with the image file. Then open the image in the viewer.

For example:‚Äč

Via the Project file:

  Pixel.TransparentZone1= $000000, $5F5F5f
  Pixel.TransparentZone2= $AFAFAF, $FFFFFF

Using VB code:

  Dim layer As New TatukGIS_DK.XGIS_LayerPixel()
  layer.Params.Pixel.TransparentZones.Add("$000000, $5F5F5F")
  layer.Params.Pixel.TransparentZones.Add("$AFAFAF, $FFFFFF")

Using C# code:

  TatukGIS_DK.IXGIS_LayerPixel layer = new TatukGIS_DK.XGIS_LayerPixel();
  ((TatukGIS_DK.IXGIS_ParamsSectionPixel)layer.Params).Pixel.TransparentZones.Add("$000000, $5F5F5F");
  ((TatukGIS_DK.IXGIS_ParamsSectionPixel)layer.Params).Pixel.TransparentZones.Add("$AFAFAF, $FFFFFF");

Created: September 14, 2005, Modified: September 15, 2015