We have an application responsible for resizing images that are uploaded by the users. The new dimensions are predefined and for each uploaded image, the application creates a new image file for each of the predefined dimensions.
The problem is: The dimensions of the new images doesn't match the values that were specified to the resize method. For example:
Code: Select all
image.AdaptiveResize(60, 45);
At first, I tried the .Resize method instead of .AdaptativeResize, but the result was the same. Since I wasn't sure if this is the expected behavior or not, I searched the documentation but couldn't understand the situation yet.
Do you guys know if there is a way to 'force' the new image to respect the determined width and height or not? Bellow is the application code:
Code: Select all
using (MagickImage image = new MagickImage(originalImagePath))
{
image.Format = MagickFormat.Pjpeg;
image.AnimationDelay = 50;
image.Quality = 60;
image.Depth = 8;
image.AdaptiveResize(newWidth, newHeight);
using (FileStream fs = new FileStream(newImagePath, FileMode.Create))
{
image.Write(fs);
}
}