batch cropping

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
sj29
Posts: 2
Joined: 2011-03-04T01:11:08-07:00
Authentication code: 8675308

batch cropping

Post by sj29 »

Hi,

Im new to image magick and I need to batch process a large number of scanned book *.tif images.
While scanning and converting of the pictures, the conversion software embeded his logo in to these pictures (see below) and I wish to remove this.
http://img543.imageshack.us/img543/381/goldfish.png

Anyone has an Idea how to do this with IM?

Many thanks for help
IM Version: 7:6.5.7.8-1ubuntu1.1
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: batch cropping

Post by fmw42 »

You can use convert on one image or mogrify on many images. For example, if all the logos are in the same place at the top as this one, then

convert goldfish.png -gravity north -chop 0x80 goldfish_tmp.png

or for many images, set up two directories, say proc1 and proc2. Put all your images in proc1 and direct mogrify to put the results in proc2

cd proc1
mogrify -path /pathto/proc2 -format tif -gravity north -chop 0x80 *.tif

See the various methods of cropping, shaving, chopping at http://www.imagemagick.org/Usage/crop/

see mogrify at http://www.imagemagick.org/Usage/basics/#mogrify
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: batch cropping

Post by anthony »

Looking at the 'goldfish' document. it looks like the logo is very invasive. It it overlays actual scanned text you will loose that text.

However in the example you gave the logo is well separated from the rest of the image. A simple -chop should remove it.
See http://www.imagemagick.org/Usage/crop/#chop
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply