Hi,
i use multicrop to cut picture from a former plate (thanks to Fred Weinhaus for support)
multicrop -g 5 -f 20 -b "gray(15%)" -m save -p 4 tmp_000.jpg tmp_new.png
After using multicrop i have pictures like this http://derilzemer.de/producer/Testseiten/single_pic.htm
Now i want to remove the background but nothing works for me (probably i do it wrong ). Can anyone tell me what i have to do??
for example i use
convert tmp_new.png -alpha set -virtual-pixel transparent -channel A -blur 0x8 -threshold 50% +channel tmp-test.png or
convert tmp-new.png -bordercolor black -border 1 -fuzz 20% -fill none -draw \"matte 0,0 floodfill\" -trim +repage tmp-test.png
but nothing happend. Thanks for your hints
regards
Andreas
problem to get transparency for picture background
-
- Posts: 21
- Joined: 2011-12-12T12:18:16-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: problem to get transparency for picture background
You may need to increase the fuzz value. Note I have removed the escapes on your quotes and it works fine for me on IM 6.8.9.0 Q16 MAC OSX in the command line. What version of IM are your using and what platform? Are you using it in PHP exec()? Does it work in the command line?
Code: Select all
convert tmp-new.png -bordercolor black -border 1 -fuzz 20% -fill none -draw "matte 0,0 floodfill" -trim +repage tmp-test.png
-
- Posts: 21
- Joined: 2011-12-12T12:18:16-07:00
- Authentication code: 8675308
Re: problem to get transparency for picture background
Hi Fred,
i use the command line because later i would like to use it with a script. I tested the command and look at the result with with backgound
http://derilzemer.de/producer/Testseiten/single_pic.htm
I would like to use it with a black background then the result look like that
http://derilzemer.de/producer/Testseite ... pic_bb.htm
FYI. If i use the former plate for the scan i use little metal plates to weight the pictures down. This is what you can see in the corners after making transparency.
Regards
Andreas
i use the command line because later i would like to use it with a script. I tested the command and look at the result with with backgound
http://derilzemer.de/producer/Testseiten/single_pic.htm
I would like to use it with a black background then the result look like that
http://derilzemer.de/producer/Testseite ... pic_bb.htm
FYI. If i use the former plate for the scan i use little metal plates to weight the pictures down. This is what you can see in the corners after making transparency.
Regards
Andreas
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: problem to get transparency for picture background
try the following using morphology open to remove the thin white lines.
convert tmp-new.png -morphology open diamond:2 \
-bordercolor black -border 1 -fuzz 20% -fill none -draw "matte 0,0 floodfill" -trim +repage tmp-test.png
convert tmp-new.png -morphology open diamond:2 \
-bordercolor black -border 1 -fuzz 20% -fill none -draw "matte 0,0 floodfill" -trim +repage tmp-test.png
-
- Posts: 21
- Joined: 2011-12-12T12:18:16-07:00
- Authentication code: 8675308
Re: problem to get transparency for picture background
Hi,
okay using this parameter get a strange result Corners looking very good but the lettering is crazy
http://derilzemer.de/producer/Testseiten/single_pic.htm
regards
Andreas
okay using this parameter get a strange result Corners looking very good but the lettering is crazy
http://derilzemer.de/producer/Testseiten/single_pic.htm
regards
Andreas
-
- Posts: 21
- Joined: 2011-12-12T12:18:16-07:00
- Authentication code: 8675308
Re: problem to get transparency for picture background
Hi,
if i use diamond:1 the result is a little bit smoother but also not okay inside the lettering section.
Here is the result http://derilzemer.de/producer/Testseiten/single_pic.htm
regards
Andreas
if i use diamond:1 the result is a little bit smoother but also not okay inside the lettering section.
Here is the result http://derilzemer.de/producer/Testseiten/single_pic.htm
regards
Andreas
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: problem to get transparency for picture background
Yes, the morphology open will affect the whole image. The only way to treat that is to process only the corners to apply the morphology, then composite the new corners onto the image, then use the floodfill to make it all surrounded by transparency. You can use -region to process each corner or -mask to do all the corners at once without having to crop them out and composite them back. See
http://www.imagemagick.org/script/comma ... php#region
http://www.imagemagick.org/script/comma ... s.php#mask
http://www.imagemagick.org/Usage/masking/#regions
http://www.imagemagick.org/Usage/masking/#write_mask
http://www.imagemagick.org/script/comma ... php#region
http://www.imagemagick.org/script/comma ... s.php#mask
http://www.imagemagick.org/Usage/masking/#regions
http://www.imagemagick.org/Usage/masking/#write_mask