from top, trim to first white horizontal line,from bottom, trim to first black horizontal line

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
picmogic
Posts: 3
Joined: 2018-01-19T12:06:55-07:00
Authentication code: 1152

from top, trim to first white horizontal line,from bottom, trim to first black horizontal line

Post by picmogic »

Now I would like to remove/delete the rest colors, something like -trim of all non-white and non-black colors. What is the elegant way of doing it? Thanks in advance.

Background: The images I have are simply screenshots of .txt files in eaglemode, so I would like to keep only the "text containing" area, removing rest. What I am doing is, sorting the lines by length, then want to get this line shapes, simply as black field, against white. Those shapes I want to use as masks for other purposes. Thanks a lot.

UPDATE:
More precise description of the problem would be:
-from top, trim up to first white horizontal line
-from bottom, trim up to first black horizontal line
Last edited by picmogic on 2018-01-19T21:40:14-07:00, edited 2 times in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Having black text on white background plus rest colors

Post by fmw42 »

Please always provide your IM version and platform. Also post an example image to some free hosting service that won't change your image format (such as dropbox.com) and put the URL here, so that we can see exactly what you are trying to do.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
picmogic
Posts: 3
Joined: 2018-01-19T12:06:55-07:00
Authentication code: 1152

Re: Having black text on white background plus rest colors

Post by picmogic »

convert --version
Version: ImageMagick 6.7.7-10 2017-07-31 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

ubuntu 14.04 LTS
picmogic
Posts: 3
Joined: 2018-01-19T12:06:55-07:00
Authentication code: 1152

Re: Having black text on white background plus rest colors

Post by picmogic »

Imagine any of those text files, but just zoomed in to a single one. So you have this blueish surrounding around the white text field. I would like to keep only this box, as a first step to my story above.
http://eaglemode.sourceforge.net/screenshots/em_b02.jpg
Post Reply