Inserting 32b image -> feathered edge black

Found a bug? Tell us about it here

Moderator: DPlotAdmin

Post Reply
User avatar
Roberto
Posts: 102
Joined: Sun Mar 16, 2008 6:11 am
Location: Netherlands Beek en Donk

Inserting 32b image -> feathered edge black

Post by Roberto »

Hi,

E.g. PNG images can be saved with a transparent background (color depth 32bit instead of 24bit).

When importing such an image in DPlot the transparency is correctly respected.

However, when I import a 32b PNG image with feathered edges (edges gradually in-/decreasing in transparency) the transparency opacity transition areas are instead showing a black/white transition area: when transparency is 100% then DPlot respects transparency but when not 100% it's a grey shade.

Not that DPlot should be considered a fully featured image editor but if solving this (minor) issue wouldn't involve a great deal of efforts it would be nice if someday this inconvenience could be tackled :?
Roberto
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

I had not considered transparency before. I guess the first question is what do you think should happen with transparent pixels? The only obvious answer to me is that 100% transparent pixels should be ignored. But what to do with 1%-99% transparent pixels?
Visualize Your Data
support@dplot.com
User avatar
Roberto
Posts: 102
Joined: Sun Mar 16, 2008 6:11 am
Location: Netherlands Beek en Donk

Post by Roberto »

Hi David,

Sorry for the late reply; forgot about my post and wasn't sure I would receive an email notification once my post was replied to.

The transparency is a fourth 'color' channel: the 'alpha' channel next to the red, green and blue channels of an individual color pixel.
The color of the pixel (r,g and b values, each having a value of 0...255) needs to be blended with the color of the pixel beneath the image containing transparency while the amount of blending depends on the 'percentage' (actually also a value of 0...255) of transparency (value of alpha channel). It's a blending of color rather than a shade of gray (eventhough a single alpha channel can be represented by a gray scale image but that's only for visualisation of the transparency 'mask').

I do not know the blending math but there is a lot to find about it on the internet; even Wikipedia covers the subject. But instead of re-inventing the wheel or figuring out the logics perhaps it's better to take advantage of other people's knowledge who are in to this matter. E.g. www.filtermeister.com is having a users group who are on a regular basis doing all kinds of things with image effects (filtermeister is a plugin on its own that is designed to develop plugins (.8bf extension) to create image effects. filtermeister and the plugins created with it can be installed to Photoshop, Paintshop Pro, Corel PhotoPaint, Serif PhotoPlus and some more image editors supporting Adobe Photoshop compatible (8bf) plugins. In that group asking the math behind how to blend an overlaying image containing transparency with the image underneath it, should give you a usable answer by one or more group members.
Roberto
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Sorry for the late reply; forgot about my post and wasn't sure I would receive an email notification once my post was replied to.
The reply e-mail gizmo is broken, sorry.
The transparency is a fourth 'color' channel: the 'alpha' channel next to the red, green and blue channels of an individual color pixel.
The color of the pixel (r,g and b values, each having a value of 0...255) needs to be blended with the color of the pixel beneath the image containing transparency while the amount of blending depends on the 'percentage' (actually also a value of 0...255) of transparency (value of alpha channel). It's a blending of color rather than a shade of gray (eventhough a single alpha channel can be represented by a gray scale image but that's only for visualisation of the transparency 'mask').
I know how the transparency byte in 32-bit PNG images works. Sorry I wasn't clear. The problem is DPlot doesn't care about any of that and neither does the bitmapto3d plugin. The plugin converts your image to 8 bit grayscale regardless of what you start with, then maps those 256 possible gray values to Z values. There's nothing about color (or transparency) that is preserved. I could add a transparency mask to the surface plot, but since (guessing here) something like 99.9% of users are simply plotting a surface on a white background I can't see this being especially useful. But it is worth thinking about. Thanks for your input.
Visualize Your Data
support@dplot.com
Post Reply