Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm still looking for a white to transparent filter. This program fails to do that properly, if i look at shadow in the transparent examples with the boot.

Any recommendations other than keeping Photoshop CS5 around just to use KillWhite [1]? (Why Adobe axed Pixel Bender[2] is still just beyond me.)

MathMap for gimp looks promising to create pixel-filters, yet I haven't tried it yet. Being able to to this on commandline would be nice, but isn't a requirement.

[1]http://mikes3d.com/extra/scripting-plugins/killwhite/

[2]http://www.adobe.com/devnet/pixelbender.html

[3]http://www.complang.tuwien.ac.at/schani/mathmap/



In standard gimp this functionality is available in Colors - Color to Alpha. Maybe I'm misunderstanding what you're looking for.


Thanks for the hint, just tried it and it not behaving as I need to.

Expected behavior in HSL color space would be anything with the same Hue and Saturation value (with optional adjustable thresholds) of a selected color gets assigned an alpha value of 1 - lightness. Where lightness of 1 being white and alpha of 1 being opaque.

KillWhite seems to do exactly this: http://mikes3d.com/extra/wp-content/uploads/2010/07/apple.pn...

I guess by now, it's easiest for me to re-implement this as a filter for HTML5 2DCanvas.


Yes white (the default, or any color you set) to transparent is definitely 'Colour to alpha'. Works great and you can repeat for multiple colours in the same image.


Imagemagick is good for command-line processing. http://www.imagemagick.org/Usage/masking/#alpha


If you download the pixel blender version of the kill white plugin, you can read the source. It looks pretty simple to implement; does just a little work while in the HSV color space.


Just dived into that too, looks pretty straight-forward.

Here is the comparison between KillWhite's method and gimp's color to alpha:

http://i.imgur.com/FGJE97r.png

Note that it adds transparency pretty much everywhere on the apple and alters it too much. (Reflection on apple is gone after blending with new background)


I'm about 98% certain:

Killwhite is identical to Gimp's "Color to Alpha" if you use white as source color.

In their example, it leaves a grey color background with a little alpha. They started with a brighter blue, and was dimmed by the their resulting image.

I'm guessing that in your example, you used the background grey as the input color, so it took the background to clear, then you used a color sample of Killwhite's background to use as the background of yours. ...but I may be wrong.

edit: I am playing with it, and if you use white as the color, then put the result on the white background, it's identical to the original., if you do the same with the grey color, same results. So "Color to Alpha" is the same, just allows you to pick a color.


They are not identical.

If this [1] is the actual code it looks like it's operating in RGB color space.

Which explains why it extracts the lowest value color component as alpha from every pixel and not just from those with low saturation.

    alpha1 = (1 - a1) / (c1);
This is done three times, for each RGB channel once. c is the selected color (in this case white with c1, c2, c3 = 1)

a are the channels of the current pixel (a1, a2, a3)

Later the highest alpha (lowest transparency) is kept for the output.

Which results in the effect that all highlights, regardless of their saturation, are made transparent.

Meanwhile the core function of KillWhite is executed in HSV color space:

    Alpha = 1 - (Value - Saturation)
Here Saturation reduces transparency! This is not the case in color to alpha.

[1] https://git.gnome.org/browse/gimp/tree/plug-ins/common/color...

[2] http://stackoverflow.com/a/14915403/731179

if there is need for further discussion I would suggest switching to stackexchange. Adding to

http://superuser.com/questions/348167/how-can-i-remove-all-w... or http://graphicdesign.stackexchange.com/questions/13073/alpha...

or open something new




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: