fmw42 wrote: ↑2018-01-31T13:24:04-07:001) Are you asking for a -define or new geometry flag that would crop 3:2 relative to the largest dimension of the image, such that it would automatically handle landscape or portrait mode images (rather than the user specifying 3:2 vs 2:3)?
The default appears to crop the largest W:H area without regard to the proportions of the input image. The first command here results in a 640x427 crop from the center of the logo. The second will produce a 320x480 image cropped from the center...
Code: Select all
magick logo: -gravity center -crop 3:2 result.png
magick logo: -gravity center -crop 2:3 result.png
My suggestion would be a flag that can be added to force the crop to follow the proportions of the input, automatically handling landscape or portrait mode. These next commands with a flag like a bang "!" for example, would produce identical 640x427 outputs...
Code: Select all
magick logo: -gravity center -crop 3:2! result.png
magick logo: -gravity center -crop 2:3! result.png
2) Are you also asking for an option to the crop to be such that it crop relative to the smaller dimension and thus fill with pad so that the result has 3:2 with background filling? This might be done with the ^ flag such as 3:2+X+Y^
Yes. I think that would be particularly useful with "-extent" because we already use that operation to increase the canvas beyond the dimension of the input image. A flag like a caret "^" for example, in a command like this would produce an output image of 640x960, with the area outside the input image filled with the current background color...
Code: Select all
magick logo: -gravity center -crop 2:3^ result.png
It could even be that "-crop 3:2" could make the largest possible 3:2 size fully inside the input image, and "-extent 3:2" could default to making the 3:2 fully include the input by adding padding as necessary. Then either one could by default follow the W:H specified in the argument, and if there is a "!" flag the crop/extent could adhere to the proportions of the input image, larger ratio dimension aligning with the longer side of the image.
These are just some thoughts based on occasional forum questions and a few situations I've encountered. I know there are fairly easy methods to get these results with simple FX expressions, but if the aspect ratio option is available for "crop" and "extent", an option or two to accommodate some of the more common needs seems like it could come in handy.