Page 1 of 1
SOLVED**Removing shadow
Posted: 2014-03-28T11:29:40-07:00
by jeff
I have a number of photos of people's drawings that have been taken by a research assistant. Unfortunately, this massive set of photos was taken in poor lighting, so there is some shadow. I am looking for a way to get rid of the shadow on all the photos. I have tried sharpening, using a mask, using fuzz, etc, but I am beginning to think there is no way to do it. Here is an example photo for reference, and the ideal (though admittedly improbable) result would be a plain white background with the line drawing as foreground. Any help would be appreciated.

Re: Removing shadow
Posted: 2014-03-28T11:46:00-07:00
by fmw42
try this (increase the blur from 5, if needed)
Unix syntax:
Code: Select all
convert 255q24i.jpg \( -clone 0 -blur 0x5 \) +swap -compose divide -composite result.png
Windows syntax:
Code: Select all
convert 255q24i.jpg ( -clone 0 -blur 0x5 ) +swap -compose divide -composite result.png
In the future, please identify your IM version and platform.
See
http://www.imagemagick.org/Usage/compose/#divide
Re: Removing shadow
Posted: 2014-03-28T12:08:30-07:00
by Bonzo
A good result fmw42
Re: Removing shadow
Posted: 2014-04-02T12:55:27-07:00
by jeff
Thanks so much, that worked perfectly fmw42. Sorry about the lack of info on my version and platform
Re: Removing shadow
Posted: 2014-04-02T13:58:44-07:00
by jeff
I have on followup concern, but before I get to that,
I am on Windows 7 Professional 64 bit,
using ImageMagick-6.8.8-10-Q16-x64-dll
So, I would like to be able to do this same transformation for all the files in a given directory.
Unfortunately, 'mogrify' is apparently not compatible with -clone or -compose, and any time I attempt to use 'find', it says that it is not recognized as an internal or external command. Does anyone have any solutions?
Thanks,
Jeff
Re: Removing shadow
Posted: 2014-04-02T14:19:12-07:00
by jeff
Nevermind, solved it.
Thanks anyways
Re: Removing shadow
Posted: 2014-04-02T14:24:59-07:00
by fmw42
jeff wrote:Nevermind, solved it.
Thanks anyways
What was your solution?
Re: SOLVED**Removing shadow
Posted: 2014-04-02T14:31:32-07:00
by jeff
Code: Select all
for %a in (*.jpg) do convert %a ( -clone 0 -blur 0x5 ) +swap -compose divide -composite -sharpen 0x5 %a
Warning to anyone intending to use, the way I have it coded will replace the original file with the new version. I also added the sharpen feature into the code provided by fmw42 because I wanted the lines of the image to be more pronounced once the shadow was removed.