Remove pixels from each size to create image square!

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Give this a go:

Code: Select all

convert img1.jpeg -crop 480x480+160+160 +repage img2.jpeg
I would have thought you could probably use -gravity center but I am not sure how.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Better to do a centered crop...

Code: Select all

convert img1.jpeg -gravity center -crop 480x480+0+0 +repage img2.jpeg 
If on the other hand you are resizing the image to size a 480x480 box with edges clipped then you can use the formulas given in IM Examples
Thumbnails, Cut the Image to Fit
http://www.cit.gu.edu.au/~anthony/graph ... nails/#cut
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply