Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Commented Issue: Issue with MagickGeometry arguments [1358]

$
0
0

I am using the following code to resize the image. Which fetches the image in response object and the create an MagickImage object and resize it according to the width and height passed to the MagickGeometry object. It works fine till the time you pass the int value of height and width but when you pass the double value (surprisingly it accept double argument) then final re-sized image come of random size. Could you please look into it.

```
MagickImage image = new MagickImage(response);
{
double masterWidth = image.Width;
double masterHeight = image.Height;

if (masterWidth < width || masterHeight < height)
{
MagickGeometry size = new MagickGeometry(masterWidth, masterHeight);
size.IgnoreAspectRatio = true;

image.Resize(size);
}
}
```
Comments: You are actually calling the overload that uses percentages because there is an implicit cast from double to percentage. I will change this cast to an explicit cast in the next version of Magick.NET. So you will have to cast your doubles to integers when you create the MagickGeometry: ```C# MagickGeometry size = new MagickGeometry((int) masterWidth, (int) masterHeight); ```

Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>