Aspect Ratio

Jun 28, 2013 at 1:19 AM
Edited Jun 28, 2013 at 1:20 AM
I'm trying to size images with a height and width but do not wish to use the Aspect Ratio. Is there currently a way to handle this?
Coordinator
Jun 28, 2013 at 4:56 AM
You should be able to do that by setting the Aspect property of MagickGeometry to true. I will rename that property before the next release to make it less confusing.
using (MagickImage image = new MagickImage("Snakeware.jpg"))
{
  MagickGeometry geometry = new MagickGeometry(100, 100);
  geometry.Aspect = true;
  image.Resize(geometry);
}
You will probably get better results when you crop the image:
using (MagickImage image = new MagickImage("Snakeware.jpg"))
{
  image.Crop(100, 100, Gravity.Center);
}
Jun 28, 2013 at 10:24 AM
Edited Jun 28, 2013 at 10:36 AM
Thank You!! This library is amazing and cuts down on the hassle of having to constantly save everything on the file system! Keep up the great work!!

I did have one other question and maybe I should have included this in another thread. However, I was wondering how the "Quality" property meshed with the Density setting? I think my expectation was to set the density at say 36,36 and get a lower resolution file with a smaller file size. That seems to happen when the Quality is set low. Your thoughts?

Thanks!
Coordinator
Jun 28, 2013 at 4:04 PM
The density (DPI) does not affect the file size. Here is an interesting article: http://www.johnny-pixel.com/avm/dpi_confusion.php. What kind of image format is your output file? Compression/quality depends on the output format.