Page 1 of 1

Create (semi-) transparency on "shaded" areas of an image

Posted: 2013-06-21T00:40:32-07:00
by blindcoder
Hello.

I have this images and many more like it: https://docs.google.com/file/d/0B5ZUp1_ ... h2X2c/edit
What I want to achieve is getting all black areas transparent and all "shaded" areas (ie: the part behind the trees) either also transparent or ideally semi-transparent
Currently I use this command to get the transparency:

Code: Select all

convert screenshot.jpg -black-threshold 1% -transparent black screenshot_transparent.png
But that leaves me with a lot of opaque shaded areas.

I'm happy for any suggestion!

Re: Create (semi-) transparency on "shaded" areas of an imag

Posted: 2013-06-21T06:45:11-07:00
by snibgo
I don't know what defines the parts you want to be transparent.

If I assume you want black (0% level) to be fully tansparent, with transparency reducing to zero at 20% level, this (Windows script) would do the trick.

Code: Select all

convert ^
  Fri_Jun_21_08_38_06_CEST_2013.jpg ^
  ( +clone -level 0,20%% ) ^
  -compose CopyOpacity -composite ^
  f.png
But parts of the trees, and the figure's trousers, are partially transparent.

Re: Create (semi-) transparency on "shaded" areas of an imag

Posted: 2013-06-23T22:14:03-07:00
by anthony
It may be better to put it in a different colorspace. Say something that separates luminance from chroma or saturation.
HSB, Lab, Luv are all possibilities.

This way a darker color does not effect results as much.