如何在C#中调整位图图像的大小而不进行混合或过滤? [英] How to resize a bitmap image in C# without blending or filtering?

查看:153
本文介绍了如何在C#中调整位图图像的大小而不进行混合或过滤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要放大的灰度图像,以便可以更好地看到各个像素.我曾尝试将平滑"模式设置为无",并将插值模式"设置为其他一些模式(如此处其他问题所建议),但是图像在我看来仍像是在进行某种混合,然后才在屏幕上显示. >

基本上,如果我的图像是

(White, White,
 White, Black)

我想将其放大为6x6时看起来像

 (White, White, White, White, White, White
  White, White, White, White, White, White
  White, White, White, White, White, White
  White, White, White, Black, Black, Black
  White, White, White, Black, Black, Black
  White, White, White, Black, Black, Black)

黑白区域之间不褪色,应看起来像正方形.图片应该看起来更像素化",而不是模糊"

解决方案

尝试设置插值模式:

g.InterpolationMode = InterpolationMode.NearestNeighbor;

I have a gray scale image that I would like to enlarge so that I can better see the individual pixels. I've tried setting Smoothing mode to none and some different Interpolation Modes (as suggested on other questions on here), but the images still appear to me as if they are still doing some sort of blending before being displayed on the screen.

basically If I have a image that is

(White, White,
 White, Black)

I want when I enlarge it to say 6x6, it to look like

 (White, White, White, White, White, White
  White, White, White, White, White, White
  White, White, White, White, White, White
  White, White, White, Black, Black, Black
  White, White, White, Black, Black, Black
  White, White, White, Black, Black, Black)

With no fading between the black and white areas, should look like a square. The image should look more "pixelized" rather then "Blurry"

解决方案

Try to set interpolation mode:

g.InterpolationMode = InterpolationMode.NearestNeighbor;

这篇关于如何在C#中调整位图图像的大小而不进行混合或过滤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆