This project has moved. For the latest updates, please go here.

modifying either width or height?

Aug 11, 2014 at 11:16 PM
This is probably a very basic question. I have a situation where I just want to modify one side of an image when doing a conversion, and have the aspect ration maintain. So if I want to make the width to be 3000, I want the height to adjust accordingly to keep it's quality. From what I can tell, .resize() and .scale() require both values. Also, I know that using MagickReadSettings, I can specify one when reading the source image, but that does not seem to have an effect either. But I might be missing something.
Coordinator
Aug 12, 2014 at 7:52 AM
Edited Aug 14, 2014 at 10:14 AM
The trick to do this in ImageMagick is by specifying a width or height that is zero for the value that you want to have calculated. An image with a height of zero pixels is not that useful so that is why this value was chosen.
using(MagickImage image = new MagickImage("logo:"))
{
  image.Resize(3000,0);
}