Removing single color shadow / White to transparent

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Removing single color shadow / White to transparent

Post by Cmars »

Well I'm trying to add a remove shadow on my bot but I can't seem to get it right (like always)
Image:
Image
Close up:
Image

Also, removing the white transparent out interrupting the image (if has white inside the image)
Thank's for reading.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Removing single color shadow / White to transparent

Post by fmw42 »

Your alpha channel is totally white. So no transparency anywhere. You need to make a (b/w or grayscale) mask to cut out the parts you don't want and then overlay that on your base image.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Removing single color shadow / White to transparent

Post by anthony »

I would start by turning white into a masking image. then mody that mask by removing any pixel that is down and left of another pixel in the mask! that will remove the 'shadow'

Hmmm...
First the mask...

Code: Select all

  convert image.png -negate -threshold 0 mask.png
now get rid of the shadow

Code: Select all

  convert mask.png \( +clone -roll -1-1 \) -compose multiply -composite mask2.png
and apply mask to image

Code: Select all

  convert image.png mask2.png -alpha off -compose CopyOpacity -composite  result.png
Image

there you go, masked and a one pixel shadow removed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Cmars
Posts: 8
Joined: 2010-10-29T12:03:56-07:00
Authentication code: 8675308

Re: Removing single color shadow / White to transparent

Post by Cmars »

Thank you anthony
Post Reply