>  Docs Center  >  Libraries  >  Coyote  >  CGTRANSPARENTIMAGE


  Creates a semi-transparent image for display. Optionally, a "missing"
  color or color index (for 2D images) can be set to a completely transparent value.
  The transparent image can be saved as a transparent PNG file.




    image: in, optional, type=byte
      A 2D image or a 24-bit image with or without an alpha channel. If an alpha
      channel is present, it will be modified by the program.


    brewer: in, optional, type=boolean, default=0
        This keyword is used only if the `CTIndex` keyword is used to select a color table number.
        Setting this keyword allows Brewer color tables to be used.
    ctindex: in, optional, type=integer
        The index number of a color table. The `Brewer` and `Reverse` keywords will be checked
        to see how to load the color table into the `Palette` keyword. This keyword will take
        precidence over any colors that are loaded with the `Palette` keyword.
    missing_value: in, optional, type=various
        The "color" of a pixel that will be treated as a "missing" color or value.
        Any pixels in the image with this color value will be set completely
        transparent. If `Color` is a string, use cgColor to obtain a color triple.
        If `Color` is a non-strint scalar, this value is taken to be the missing color index
        in a 2D image. Otherwise, this is assumed to be a color triple that indicates
        the "missing" color or value in the output image. The alpha channel in the output image
        is set to 0 for the "missing" color, which makes this value completely transparent.
    filename: in, optional, type=string
        The name of an image file that can be read with READ_IMAGE. Used to
        select the input image if the `image` parameter is not used.
    nogui: in, optional, type=boolean, default=0
        Set this keyword if you do not wish to have the user confirm the name of
        the output PNG file selected with the `PNGFile` keyword.
    palette: in, optional, type=byte
        Set this keyword to a 3x256 or 256x3 byte array containing the RGB color
        vectors to be loaded before the transparent image is created. Such vectors can be
        obtained, for example, from cgLoadCT with the RGB_TABLE keyword::
                IDL> cgLoadCT, 4, /BREWER, /REVERSE, RGB_TABLE=palette
                IDL> tImage = cgTransparentImage( cgDemoData(7), PALETTE=palette)
        The default is to use whatever colors are loaded in the current hardware color table.
        A palette applies only to 2D input images.
    pngfile: in, optional
        If this keyword is set, the output image is written as a transparent
        PNG file in 4xMxN format. Optionally, this keyword can be set to the
        name of the output PNG file. The user will have the option of confirming
        the name of the output file, unless the `NoGUI` keyword is set.
    reverse: in, optional, type=boolean, default=0
        Set this keyword to reverse the color table vectors selected with the `CTIndex` keyword.
    transparent: in, optional, type=integer, default=50
        The percentage of transparency desired in the output image. A number
        between 0 and 100.
    wset: in, optional, type=long
        If image parameter is not present, make the window indicated with
        this keyword the current graphics window for obtaining an image parameter.
        If not passed, and no image is present, then the current graphics window is
        used to create the image.


      cgDisplay, WID=0
      cgImage, cgDemoData(5), CTIndex=0, /Interp
      timage = cgTransparentImage(MISSING_VALUE='black', TRANSPARENT=50)
      cgDisplay, WID=1
      cgImage, cgDemoData(7), CTIndex=22
      cgImage, timage


      David W. Fanning
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com


    Change History::
        Written, 23 October 2012 to replace Make_Transparent_Image, which was retired. DWF.


    Copyright (c) 2012, Fanning Software Consulting, Inc.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us