Hello together,
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.
The commands i use are attached as a code snippet.
The result is always the same: the source image gets resized to fit either height or width of the area placed into. It does not get cropped. Therefore i always and up with my target image to contain the source image, but also thick white borders.
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!
Start Free Trial