在调整大小厘米C#的图像 [英] Resizing an image in cm C#

查看:370
本文介绍了在调整大小厘米C#的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求用10×6.88厘米的图像的要求。
我知道,我可以从厘米不简单转换为像素,使一个像素的大小取决于用户的显示分辨率。
我想知道是否有调整图像的大小,以在该厘米大小的一种方式。 (我需要保持图像扩展还如:不能将其转换为PDF或其他扩展名)

I have an requirement that asks for an image with 10 X 6,88 cm. I know that I can't simple convert from cm to pixels, cause one pixel size depends on the user display resolution. I would like to know if there is a way to resize an image to have that size in cm. (I need to keep the image extension also. e.g.: can't convert it to a pdf or other extension)

推荐答案

据实际上取决于其分辨率,用户将打印的图像(尺寸厘米意义不大打印时比其他)。如果用户想要在打印,说200 DPI,那么图像就需要由(6.88 / 2.54 * 200)像素为(10 / 2.54 * 200)(需要用2.54的师厘米和英寸之间转换)。即需要哪些分辨率是高度依赖于它是什么样的形象,以及用户的质量要求。

It really depends on in which resolution the user will print the image (sizes in cm makes little sense other than when printed). If the user wants to make a print in, say 200 dpi, then the image would need to be (10 / 2.54 * 200) by (6.88 / 2.54 * 200) pixels (the division with 2.54 is needed to convert between cm and inches). Which resolution that is needed is highly dependent on what kind of image it is, and the quality requirements of the user.

所以才说:我想通过调整大小与X Ÿ厘米并没有真正意义。

So just saying "I want to resize to X by Y cm" does not really make sense.

有关如何进行实际调整大小,一旦你已经想通了图像的所需大小的代码示例,的这个SO回答应包括你的需求。

For a code sample on how to make the actual resize once you have figured out the needed size of the image, this SO answer should cover your needs.

这篇关于在调整大小厘米C#的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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