Page 1 of 1

Removing a shadow from an image

Posted: 2018-08-15T15:36:29-07:00
by shadow_man
Hi there,

I've been trying to remove a shadow from an image for some time as well as make the background transparent, but have had a great deal of difficulty.

Here are two starter images:
Image

and
Image

I have been successful in removing backgrounds and making these images transparent, seen in cases here:

Image
and
Image respectively.

This was done using this script:

Code: Select all

convert Last\ Shot\ \(2018\)-f6179a7a-7b21-41a5-87bf-885268f78e04\ \(1\).jpg -alpha set -bordercolor white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" result1_fill.png
However, the bottom shadow has been a real tricky problem to solve, mainly because it is not entirely black, and although always at the bottom of the shoe, it never fully is one colour or another, or is sometimes blocked by a shoe part.

I was thinking of setting up a meta mask and cutting off the bottom of the shoes, but this didn't work as I expected. I then tried adding a background of black with a higher than usual fuzz (around 10%) to try and get the background and shadow all one colour. Once done, i was going to set the black to transparent. Yet this did not work either.

Anyone have any suggestions that could help?

Re: Removing a shadow from an image

Posted: 2018-08-15T16:28:29-07:00
by fmw42
Shadows are particularly hard to remove as per isolating the objects from the background. I am not sure there is any good way to do that in Imagemagick when the shadow color is close to the object color. I will defer to anyone with a good suggestion.

You could try one of tools such as clipping magic --- https://clippingmagic.com

Re: Removing a shadow from an image

Posted: 2018-08-15T16:59:42-07:00
by shadow_man
fmw42, do you think there is someway to isolate that image itself though? Some set of trim/bordering function?

I've tried a few with little results...

Re: Removing a shadow from an image

Posted: 2018-08-15T19:14:02-07:00
by fmw42
No, I have never had much success in these situations. If the shoes are a different color from the shadow and the background is white, then you have a chance. But not with either near black or near white shoes.