how I could remove a circle of this image using connected components remove?

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
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

how I could remove a circle of this image using connected components remove?

Post by diegomage »

Image



You may want to remove certain objects by making them transparent. Use -define connected-components:remove=list-of-ids (e.g. -define connected-components:remove=2,4-5).


using a command like this

Code: Select all

convert image  -define connected-components:remove=2,4-5 outimage
please help me
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how I could remove a circle of this image using connected components remove?

Post by fmw42 »

Try this (Unix syntax)

Code: Select all

convert image.jpg -auto-level -threshold 50% -type bilevel \
-define connected-components:remove=2,4-5 \
-define connected-components:mean-color=true \
-connected-components 4 \
result.png
Image

For Windows replace \ with ^

Note, the -auto-level -threshold 50% -type bilevel is needed to make it only two colors. JPG is compressed and does not maintain constant colors well.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

hi not work for me , i cant remove the circle
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how I could remove a circle of this image using connected components remove?

Post by fmw42 »

What is your Imagemagick versions and platform? You need IM 6.8.9.10 or higher for connected components.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

Version: ImageMagick 7.0.7-8 Q16 x86_64 2017-10-28 http://www.imagemagick.org

os:ubuntu 14.04
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

Code: Select all

convert bwlabel_part1_01.jpg -auto-level -threshold 50% -type bilevel -define connected-components:remove=2,4-5 -define connected-components:mean-color=true -connected-components 4 zfgresult.png
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

not work this command
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how I could remove a circle of this image using connected components remove?

Post by fmw42 »

It seems to be a bug in ImageMagick 7. I will report it. Note that IM 7 use magick in place of convert.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

not work with magick , I will try to update and test with 7.1 version
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how I could remove a circle of this image using connected components remove?

Post by fmw42 »

It is a bug in IM 7

I have reported it on the Bugs forum.
diegomage
Posts: 205
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: how I could remove a circle of this image using connected components remove?

Post by diegomage »

ok very thankyou
Post Reply