How to create square/cropped thumbnail using ImageMagick ? Cropping like below.

cropping

link|improve this question

67% accept rate
feedback

3 Answers

up vote 0 down vote accepted

"Cut the Thumbnail to Fit"

link|improve this answer
1  
Possibly... some type of description? – Hello71 Apr 27 '11 at 2:22
feedback

I think you are looking for something like:

convert -crop 100x100+50+50 input_image.jpg output_image.jpg 

where 100x100 is the size of the final rectangle and 50x50 the offset.

link|improve this answer
That crop image, but doesn't make thumbnail. – marioosh Apr 26 '11 at 11:11
@marioosh: I didn't understood, you can use convert -thumbnail 100x100+50+50 input_image.jpg output_image.jpg, for more info check Igancio Vazquez response for an example or check the documentation – pconcepcion Apr 26 '11 at 11:15
feedback

Ignacio linked to the correct documentation, however I'll paste it inline here for convenience:

convert -define jpeg:size=200x200 original.jpeg -thumbnail 100x100^ -gravity center -extent 100x100 thumbnail.jpeg

Similarly, the following is for GraphicsMagick:

gm convert -size 200x200 original.jpeg -thumbnail 100x100^ -gravity center -extent 100x100 +profile "*" thumbnail.jpeg

Explanation:

  • -size 200x200 tells the jpeg decoder we only need this resolution so it can save memory and read the source image faster
  • -thumbnail 100x100^ fast resize making the shortest side 100
  • - gravity center center the next operation
  • -extent 100x100 apply the image to a 100x100 canvas
  • +profile "*" do not save any metainfo to the jpeg (making the resulting image smaller)
link|improve this answer
When I used it in command line (graphics magick one) I got picture on center, two siders are filled with white. Not the one described in question. Am I doing something wrong? – Umut Benzer Jan 24 at 10:25
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.