Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Resizing image without keeping aspet ratio

$
0
0
Hi,
First of all thanks for this library.

I implemented Magick.net 6.8.5.4 in order to resize image on the fly on my website.
All was working perfectly but i just figure that some images were not at the specific size that i wanted.
For example, i have a wall of image and all images must have a width of 272px. And for some image when i resize the library take the liberty of resizing to 271 px.

I don't understand why, and how can i force that.?

Here is a sample of my code :
Width = 272 px and Height = 349 in this case.
MemoryStream resultStream = new MemoryStream();
           
MagickImage mimg = new MagickImage(imgStream);

mimg.Resize(width, height);

mimg.ImageType = ImageType.Jpeg;
mimg.Quality = 95;
mimg.Write(resultStream);
mimg.Dispose();
The result is that the MagickImage instance has a size of 271px x 349px

Is there a way to keep the image at the size wanted ? What i missing here ?

Thanks a lot for reading this, and sorry for my pour english.

Alex

Viewing all articles
Browse latest Browse all 3693

Trending Articles