Crop U1 from cover-image with ImageMagick

u4u1.jpg

Given is an imposed cover. The size is from a list of possible sizes, but we do not know a priori which.

Step 1: Determine the height

identify -format "%w %h %x %y" input.jpg

The output might look like this: 1700 1200 300 300. That is: 1700 pixels wide, 1200 pixels high, and 300 DPI.

Step 2: Crop

The syntax for -crop is [width]x[height]+[X-offset]+[Y-offset].

magick input.jpg -crop "[desiredWidth]x\[originalHeight]+[originalWidth-desiredWidth]+0" output.jpg