Is there an issue with C# Winforms image resizing function?
I was using this snippet of code to resize the image and display to a picture box:
Bitmap resizedImage = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(resizedImage))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.SmoothingMode = SmoothingMode.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.DrawImage(currentImageOriginalSize, 0, 0, newWidth, newHeight);
}
currentImage = resizedImage;
and the image I got was more blurry than the one displayed online using HTML (we pulled from the same image source and the web doesn't use an external library. The picture box and the picture element has the same size). Is this a known issue or did I do something wrong?
4 Replies
you can expect picturebox algorithm to not be same quality as browser, but apart from that probably an example of what you mean by blurry would help
the one on the left (or being sent first) is the one displayed on C# (the size of the container is 472*265, fit whichever way so that the image doesn't spill, leading to blackbars on the sides or on the top/bottom)
the one on the right is the image displayed on the web (the size of the container is 462x260)
the original image is 1920x1080


this is the original image, but I'm not sure if discord is going to reduce it's quality

@many things please tell me if you need more information. Thanks a lot in advance