Using SIPS, I can proportionally resize an image using
How would I achieve this result, instead?
It would be nice if I could apply something like cv2 to get a
sips -Z 256
to reduce the width and height of my image to a size no larger than 256px. Over a padded background fill, this produces a result similar to a CSS background-size: contain
resize.
However, what I'd like to get is a crop of 256x256, similar to a CSS background-size: cover
resize, where the width and height are proportionally reduced to a canvas no smaller than 256px.
sips -Z 256 "$file" --cropToHeightWidth 256 256
is close to what I'm after, but the Z
flag is leaving one side too small.


background:cover
style proportional scale with a crop position which defaults to a center-crop, but adjusts the position to prevent faces from being cropped out of the image.
Asked by iRyanBell
(111 rep)
Oct 7, 2019, 08:40 AM
Last activity: Oct 7, 2019, 04:38 PM
Last activity: Oct 7, 2019, 04:38 PM