Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to make a tool that will, in imitation of responsive design on the web, make iPhone / iPad wallpapers by taking the largest centered crop-to-device-dimensions it can, and programmatically be available.

I have an original image in landscape, and commands, one per output wallpaper, like:

convert background.png -resize 320x480 -crop 320x480+0+0 background-320x480.png

However, after the conversion, background-320x480.png's dimensions are 320x239, and all of the generated images have the same aspect ratio, notwithstanding that they are intended to cover portrait and landscape resolutions across iPhones and iPads.

The same dimensions appear if I replace the first 480 with a number in the thousands.

What is appropriate use of ImageMagick's convert to shrink a master wallpaper down to the minimum dimensions that will enclose a wallpaper dimension (preserving aspect ratio), and then crop the center of the shrunken master to wallpaper dimensions and preferably center it? Let's say my original is 1600x1200 and I am trying to make a 320x480 wallpaper.

Thanks,

share|improve this question
    
If your original is 1600x1200 (aspect ratio 1.33), how do you expect it to resize it to 320x480 (aspect ratio 0.67)? –  Peon Sep 12 '13 at 20:38
    
I intend to shrink it to 480 pixels in height, and then crop to a 320 pixel wide rectangle in the center, as stated in the question. –  Jonathan Hayward Sep 12 '13 at 20:39
    
my comment was for your original convert command which tells convert to resize to 320x480. –  Peon Sep 12 '13 at 20:58
    
"shrink... down to minimum dimensions... preserving aspect ratio... and then crop..." specifies two steps, not one. –  Jonathan Hayward Sep 12 '13 at 21:59
add comment

1 Answer 1

up vote 1 down vote accepted
  • 1600x1200 ==(40%)==> 640x480
  • crop from the center so the top left corner is moved from (0,0) to (160,0).

Try convert original.png -resize 40% -crop 320x480+160+0 reduced.png.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.