i am working on an image processing automation tool for a printshop - having vast difficultes getting to a satisfying result with an IM -crop operation.
I have researched for hours, but i just can not get it right. I guess the problem is on my side - i am pretty certain, most people can tell me the correct command right away.
The goal is to resize and crop a given image to fit into a specific area on a template. If the resized image does not perfectly fit the target area, it must be cropped (in the vertical and horizontal center) so that it fits.
I use those commands:
Code: Select all
convert files/afoch/UZ4V0121.jpg -resize 236x236 -crop 236x236+0+0 files/afoch/UZ4V0121.jpg_resized.jpg
composite -geometry +0+0 "files/afoch/UZ4V0121.jpg_resized.jpg" "files/afoch__processed/UZ4V0121.jpg" "files/afoch__processed/UZ4V0121.jpg"
I would appreciate any help on that matter!
There is two more things i wondered about:
1.) The image quality of the result is not satisfying even though it never gets enlarged but rather shrinked and even though the source image is Hi-Resolution. I tried using -quality 100 -depth 8, but the result remains the same. Why?
2.) Is there a possibility to merge the two commands i use into one, so that imagemagick has not got to be launched twice - therefore saving time and cpu.
Thank you very much!