Winforms picture scale blurry

archie456

Member
Joined
Apr 19, 2020
Messages
11
Programming Experience
1-3
Hi,

I'm creating a small painting programme to be able to edit / paint a bitmap image for use in something else.

The bitmap images are small, approx 200 pixel by 100 pixels and are displayed on a form using a Picturebox, I then use GetPixel and SetPixel to change the image.

To be able to edit the image I need to scale it up, but when I do so the pixels are blurry, I'd like to see sharp square pixels obviously there is some sort of smoothing / anti-aliasing going on.

How do I turn this of, so I can see blocky scaled up pixels?

Thanks !
 
Manually get a pixel, then paint a big square the color of that pixel. Lather, rinse, repeat.
 
How about this?
C#:
private void PictureBox2_Paint(object sender, PaintEventArgs e) {
    var originalImage = pictureBox1.Image;
    e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
    e.Graphics.DrawImage(originalImage, 0, 0,
        originalImage.Width * 10, originalImage.Height * 10);
}
 

Latest posts

Back
Top Bottom