如何使用近邻缩小图像? [英] How to downscale image using near neighbor?

查看:92
本文介绍了如何使用近邻缩小图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

该论坛的成员IronRazerz帮助我如何使用近邻来缩放图像.
现在,我需要缩小图像以进行导入,或者如果可能的话 适合或伸展.

Member of this forum IronRazerz helped me how to zoom image using near neighbor.
Now, I need to downscale image for import, or if is possible fit or stretch.

简单的例子:要导入的图像具有 64×64像素,我需要 缩小到32×32或16×16甚至8×8 .宽度和高度相同.但我也需要 将其缩小为16×32或8×16 ,也许可以通过用户选择(8-16) ×(8-32)-在此处是 更好地适应并且很有用,伸展 ...
在所有情况下,我需要单色图像,简单的 1bpp 图片,因此使用近邻只是一种方法. 抖动选项适合我 看起来也不错,但不是很想要,是因为 破坏图像一致性.

Simple example: image for import has 64×64 pixels, I need to downscale it to 32×32 or 16×16 or even 8×8 it's same width and height. But I need also downscale it to 16×32 or 8×16 maybe (8-16)×(8-32) by user selection - here is better to fit and useful is also stretch...
In all cases I need single color image, simple 1bpp image, so using near neighbor is only one way. Dithering option is for me also looking good, but not so wanted 'cause it destroys image consistency.

我是VB的初学者,我需要学习,所以这就是为什么这些Q非常简单的原因,但是解决方案可能不是那么简单.

I'm beginner in VB, I need to learn, so this is reason why are these Qs very simple, but solution is maybe not so simple.

谢谢大家的帮助.

米罗

推荐答案

Visual Basic

VB帮助器-图形

通过将PictureBox背景图像布局属性设置为Stretch并设置PictureBox的大小,将图像设置为PictureBox背景图像,并设置PictureBox的尺寸,这将导致图像在PictureBox中拉伸.然后以编程方式调整PictureBox的大小.如果用户调整PictureBox的大小 他们想如何显示图像,然后创建一个新的位图并在其中绘制PictureBox图像,以根据用户要求调整其大小.

Set image as PictureBox background image with PictureBox background image layout property set for Stretch and size the PictureBox which will cause the image to stretch in the PictureBox. Then size the PictureBox programmatically. If the user sizes the PictureBox to how then they want the image to appear then create a new bitmap drawing the PictureBox image into it sizing it to the user requirement.


这篇关于如何使用近邻缩小图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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