RE: convert -crop: suppress creation of "extra" image file.

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
SilversleevesX
Posts: 2
Joined: 2010-01-31T23:56:43-07:00
Authentication code: 8675309

RE: convert -crop: suppress creation of "extra" image file.

Post by SilversleevesX »

EDIT: My bad. I discovered my mistake. In a command such as

Code: Select all

convert gae39-3945-241-011.jpg -crop 800x1200x0x0 +repage kellybeach.jpg
...you can plainly see I had too many 'x' -es and not a single '+'. When I corrected this error in syntax, referring back here for any mistakes I might have made, the convert -crop operation produced only one file.

Too bad there's no smiley in phpBB to show you with egg on your face. :)

BZT
BZT wrote:New ImageMagick (command-line) user, and just joined this Forum.

I may be missing something, but I define "crop" as taking one image and removing the parts one no longer wants as part of it. I do not see much sense in cropping an image and then saving the unwanted bits to a separate file, as seems to be the way ImageMagick convert -crop on the command-line does things. I've looked at the different examples for the image-resize operations (to include "resize") and while -crop performs this, to me annoying and unnecessary, extra function, it is still the operation best suited for what I wish to be able to do from the command-line on certain image files, mostly JPEGs but not strictly files of any particular format.

At the same time, I've been disappointed in not finding a tag or option related directly to convert -crop to keep it from taking this extra step. While it would be nothing at all to simply delete the unwanted "-1" file, there then remains the completely unnecessary, imo, step of renaming the file containing the crop of the image I intend to keep. When you give an executable a name for an output file, you seldom expect that the output file/s you end up with will have to be renamed later.

The +repage option sounds like it should be able to suppress this "extra" file creation, and give one the output file named as desired, cropped as intended, etc. But it seems to have no such effect in its current incarnation.

I hope someone can help me with this. I don't think it should be necessary to go to other command-line utilities or GUI image editors just to get images cropped as desired.

Thanks in advance.

BZT

Code: Select all

 >> convert -version
Version: ImageMagick 6.4.0 04/17/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RE: convert -crop: suppress creation of "extra" image file.

Post by fmw42 »

convert gae39-3945-241-011.jpg -crop 800x1200+0+0 +repage kellybeach.jpg

should keep only the upper left 800x1200 pixels from your image. If that is not what you want, please explain further (and post a link to your input image) and describe what part you want to keep.

If you want to crop only the center 800x1200 then try

convert gae39-3945-241-011.jpg -gravity center -crop 800x1200x0x0 +repage kellybeach.jpg

see http://www.imagemagick.org/Usage/crop/#crop_gravity
Post Reply