Loading ...
Sorry, an error occurred while loading the content.

imgfile= draws black for transparency in PNGs

Expand Messages
  • Andrew Schulman
    I m using a proc scatterplot with a symbol imgfile= statement. The symbol image is (in one case) a PNG of a green diamond on a transparent background:
    Message 1 of 3 , Nov 13, 2006
    • 0 Attachment
      I'm using a proc scatterplot with a 'symbol imgfile=' statement. The symbol
      image is (in one case) a PNG of a green diamond on a transparent background:
      http://home.comcast.net/~andrex/bugz/diamond-green-none.png .

      Although the background is transparent, when ploticus substitutes the image
      into the plot, the background is rendered in black: see e.g.
      http://home.comcast.net/~andrex/bugz/imgfile.png . In that image, the very
      same green diamond referenced above has been plotted in the middle section
      of the graph, and as you can see the background has come out black in every
      case.

      Does anyone know what the problem or solution is? Obviously the
      transparency isn't being handled right-- is that ploticus's fault, or
      libpng's? My ploticus is 2.33, libpng is 1.2.2.

      Thanks,
      Andrew.
    • Stephen C. Grubb
      Andrew, I just used pl to generate a PNG with a transparent background that appears to work fine in firefox. So the problem probably isn t GD or LIBPNG. I
      Message 2 of 3 , Nov 15, 2006
      • 0 Attachment
        Andrew,

        I just used pl to generate a PNG with a transparent background that
        appears to work fine in firefox. So the problem probably isn't GD or
        LIBPNG.

        I believe the problem is with ploticus importing the image... it's not
        detecting that transparency is used, and/or doesn't pass this along when
        creating the result image. Have made a note to look into this further.
        Thanks for finding this problem,

        Steve


        On Mon, 13 Nov 2006, Andrew Schulman wrote:

        > I'm using a proc scatterplot with a 'symbol imgfile=' statement. The symbol
        > image is (in one case) a PNG of a green diamond on a transparent background:
        > http://home.comcast.net/~andrex/bugz/diamond-green-none.png .
        >
        > Although the background is transparent, when ploticus substitutes the image
        > into the plot, the background is rendered in black: see e.g.
        > http://home.comcast.net/~andrex/bugz/imgfile.png . In that image, the very
        > same green diamond referenced above has been plotted in the middle section
        > of the graph, and as you can see the background has come out black in every
        > case.
        >
        > Does anyone know what the problem or solution is? Obviously the
        > transparency isn't being handled right-- is that ploticus's fault, or
        > libpng's? My ploticus is 2.33, libpng is 1.2.2.
        >
        > Thanks,
        > Andrew.
        >
        >
        >


        Stephen C. Grubb scg@... x-6633
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      • Andrew Schulman
        ... Thanks to Jamie Echlin for finding the problem: the background of my PNG images wasn t properly tagged as transparent. Funny, because it showed up as
        Message 3 of 3 , Nov 15, 2006
        • 0 Attachment
          > I'm using a proc scatterplot with a 'symbol imgfile=' statement. The symbol
          > image is (in one case) a PNG of a green diamond on a transparent background:
          > http://home.comcast.net/~andrex/bugz/diamond-green-none.png .
          >
          > Although the background is transparent, when ploticus substitutes the image
          > into the plot, the background is rendered in black: see e.g.
          > http://home.comcast.net/~andrex/bugz/imgfile.png . In that image, the very
          > same green diamond referenced above has been plotted in the middle section
          > of the graph, and as you can see the background has come out black in every
          > case.

          Thanks to Jamie Echlin for finding the problem: the background of my PNG
          images wasn't properly tagged as transparent. Funny, because it showed up
          as transparent in both gimp and Firefox.

          The solution was to open the images up in gimp again, change the colormap
          mode from RGB to indexed, and resave the image. When I did that the
          transparency was properly recorded. I don't know enough about PNG and
          colormaps to understand why, but it worked. Thanks Jamie.
        Your message has been successfully submitted and would be delivered to recipients shortly.