Page 1 of 1

Can I remove border that contains an image

Posted: 2017-01-13T22:10:14-07:00
by snaplash
Hi All

Is there a way to remove the white/anycolor border that contains a logo with -trim?
or alternatively,
can I detect the dimensions of a Photo and create a mask to cover the border/logo?

I am new to image magick so please be gentle if this has already been covered, I did search.

Thank you all so much.

Mark

Re: Can I remove border that contains an image

Posted: 2017-01-13T22:22:47-07:00
by fmw42
We will need more information. Please always provide your IM version and platform, since syntax may differ. Also provide an example of your problem via posting image(s) to some free hosting service such as dropbox.com and put the URL here.

Please also read the top post in this forum. See IMPORTANT: Please Read This FIRST Before Posting at viewtopic.php?f=1&t=31228

Re: Can I remove border that contains an image

Posted: 2017-01-13T23:00:04-07:00
by snaplash
Image

I am using the latest OSX 10.10.5 with the latest IM from Homebrew but the code it will run on Linux.

Re: Can I remove border that contains an image

Posted: 2017-01-13T23:20:53-07:00
by fmw42
It is easy to remove that top using -fuzz XX% -trim +repage. But the bottom is harder because of the text. Since the text is light gray, this seems to work with a large fuzz %. The fuzz percent allow the trim to consider colors that vary from constant by that percent.

Code: Select all

convert image_full.jpg -fuzz 70% -trim +repage result.jpg
Otherwise, one would need to crop the left column of the image and use txt: output format to the terminal to see where the first and last transition from white to other than white occurred, then you could compute the crop coordinates and use -crop or -shave to remove the top and bottom.

See
http://www.imagemagick.org/Usage/crop/#trim
http://www.imagemagick.org/Usage/crop/#crop
http://www.imagemagick.org/Usage/crop/#shave
http://www.imagemagick.org/Usage/crop/#chop
http://www.imagemagick.org/Usage/files/#txt


For newbies, see
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/script/comma ... essing.php