Page 1 of 1

How to Remove 1 inch from bottom & 1/2 inch from each side

Posted: 2012-05-29T17:09:30-07:00
by BradM
I just started working with Imagemagick today.

I understand some of the basics and I have run some successful tests.

However, I have not yet figured out things for the main reason that I am working with Imagemagick.

I have a large number of jpg files that are being generated by a purchased software package.

I would like to trim off 1 inch from the bottom of each image and 1/2 inch from both the left and right sides of each image.

I would guess that this is easy to do with Imagemagick, but I have not figured it out yet.

It would be much appreciated it some one would post an example of how to do this.

Thanks,
Brad

Re: How to Remove 1 inch from bottom & 1/2 inch from each s

Posted: 2012-05-29T18:47:19-07:00
by anthony
You would need to calculate the 'shave' to perform, based on the images resolution.

In IMv6 you will need to do that externally in a shell or DOS script wrapper.

IMv7 (still in alpha development) can do this more directly using %[fx:..] escapes in the operator option arguments.
I am working to allow the same global use of percent escapes in setting options to make it even more useful.

Re: How to Remove 1 inch from bottom & 1/2 inch from each s

Posted: 2012-05-30T00:01:16-07:00
by Bonzo
You could shave as Anthony says or crop. But images work in pixels and not inches so you will either need to experiment or calculate the amounts based to remove based on the DPI as Anthony also says.

Crop = 300x300+25+0 the final image will be 300px x 300px and 25px in from the left hand side and 0 from the top

Code: Select all

convert input -crop 300x300+25+25 +repage output
If you check out my site I have an example of most of the options using php but you can see an example and the related code you can modify.

You can also see information about all the operators here: http://www.imagemagick.org/script/comma ... eonsb3v9q6

Re: How to Remove 1 inch from bottom & 1/2 inch from each s

Posted: 2012-05-30T05:25:18-07:00
by BradM
Thanks for the help, I really appreciate it.

I now have a working example of what I am trying to do.

Brad