I have an image that is saved as a size of 64x64 on disk. I load the image using this code:
resizeImage(Image.FromFile(@"C:\Users\ApachePilotMPE\Desktop\" + "img.png"), new Size(128, 128))
which returns a bitmap cast as an image like so:
public static Image resizeImage(Image i, Size newSize)
{
return (Image)(new Bitmap(i, newSize));
}
When I paint that image on the form, the sides of the object in the image (just a black & white stick figure, with a transparent background) appear as if they have been antialiased to blend with the background. Is there any way to keep this from happening? I have tried setting the Graphics.SmoothingMode
to None
at runtime, but that doesn't seem to have any effect.
Top: Painted Image when loaded in with size 64 and increased to 128.
Bottom Left: Painted Image when loaded at 128.
Bottom Right: Edited-In Image, resized with Paint.NET, size 128.
To specify: The top image SHOULD look like the bottom left.
EDIT
Check updated code at the top of the post.