How to resize image in Ruby and keep the image orientation? -


I have an image with a width of 400px and a height of 800px. I have to change this picture to something at 200px (height not important, important width). I am trying to do this:

  img.resize_to_fill! (200) .write (thumb_path)  

But the result is that the image ratio is 200 pixels at 200px. It should be replaced appropriately, so the final dimension should be 200px width and 400 px height.

How can this be done from the Magick :: Image Library?

Thanks

Width if height is not set by default

Try

  img.resize_to_fill! (200, zero). Type (thumb_path)  

Comments