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!
cropping color bars from manuscript images
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cropping color bars from manuscript images
Is the color bar and black area always the same width and position?
Re: cropping color bars from manuscript images
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: cropping color bars from manuscript images
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):
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.
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:
Code: Select all
convert ^
Us88XsY.jpg ^
-crop 1948x+0+0 ^
out.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cropping color bars from manuscript images
try this (unix syntax)
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.
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
EDIT: Sorry snibgo, we were posting about the same time.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: cropping color bars from manuscript images
As we often do. And with the same method.
snibgo's IM pages: im.snibgo.com