Page 1 of 1

cropping color bars from manuscript images

Posted: 2016-01-22T11:15:55-07:00
by jimgreer
I'm looking for some help with a fancy crop. I'm trying to cut the colorbar section (and the black area) out of manuscript images like this one: http://i.imgur.com/Us88XsY.jpg.

(I'm using version 6.9.3-0 Q16 on a Mac)

Thanks!

Re: cropping color bars from manuscript images

Posted: 2016-01-22T12:34:06-07:00
by fmw42
Is the color bar and black area always the same width and position?

Re: cropping color bars from manuscript images

Posted: 2016-01-25T08:43:09-07:00
by jimgreer
Not exactly - I was hoping for something that would just crop the black and color bar section and black based on color. Seems like that may be pretty hard to do though, so we may have to do it manually.

Re: cropping color bars from manuscript images

Posted: 2016-01-25T10:55:10-07:00
by snibgo
You've given only one example which is, of course, trivial to solve. You haven't said how other examples differ, or what they have in common. So we can only guess.

For example, perhaps the dark bar with colours always occurs on the right of the manuscript, and is always the full height of the image, and the manuscript is column-wise always lighter. If so, then a solution would be (Windows BAT syntax):

Code: Select all

convert ^
  Us88XsY.jpg ^
  +write info: ^
  -scale "x1^!" ^
  -bordercolor Black -border 1 ^
  -fuzz 20%% ^
  -format "%%@" ^
  info:
This tells me the input image is 2576x2542 pixels, and the manuscript is in the first 1950 columns. The edge is a bit fuzzy, so I'll subtract 2 pixels to clean it up.

Code: Select all

convert ^
  Us88XsY.jpg ^
  -crop 1948x+0+0 ^
  out.png

Re: cropping color bars from manuscript images

Posted: 2016-01-25T10:57:59-07:00
by fmw42
try this (unix syntax)

Code: Select all

height=`convert Us88XsY.jpg -format "%h" info:`
width=`convert Us88XsY.jpg -crop 100x1%+0+0 +repage -bordercolor black -border 10 -fuzz 35% -format "%@" info:- | cut -dx -f1`
convert Us88XsY.jpg -crop ${width}x${height}+0+0 +repage result.jpg
This assumes the top 1% on the right is nearly black and has no color in it.

EDIT: Sorry snibgo, we were posting about the same time.

Re: cropping color bars from manuscript images

Posted: 2016-01-25T11:09:22-07:00
by snibgo
As we often do. And with the same method.

Re: cropping color bars from manuscript images

Posted: 2016-01-26T11:37:40-07:00
by jimgreer
Thanks!