1

I would like to generate thumbnails for my website. Now I am using the following to process folder (based on this answer):

mogrify -interlace Plane -thumbnail 280x210^ 
-gravity center -extent 280x210 -quality 85% *.jpg

This will create thumbnails with given size (resize and crop).

I also have single image version of this command:

convert test.jpg -interlace Plane -thumbnail 280x210^ 
 -gravity center -extent 280x210 -quality 85%  testout.jpg 

I'm also using facedetect to get positions of faces from the original image (before creating thumbnails). For photos with faces I have calculated average X, Y position of faces center.

Now, I would like to use this position in the command above to crop pictures smarter. Currently image is cropped from both sides (-gravity center), but I would like to use my coordinates so faces are displayed when image is cropped.

Is there a way how I can feed this into imagemagick?

Community
  • 1
  • 1
Tomas Greif
  • 21,685
  • 23
  • 106
  • 155

1 Answers1

1

You could use -shave to remove part of the image, so that the face moves to the center, then apply your original command.

Mau
  • 14,234
  • 2
  • 31
  • 52