根据高度/宽度C#设置图像DPI [英] Setting image DPI in relation to height/width C#

查看:1301
本文介绍了根据高度/宽度C#设置图像DPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个应用程序将一些图像发送给第三方,图像必须是200x200 DPI。图像是位图,大小为500宽度和250高度。

I'm writing an application to send some images to a third party, and the images must be 200x200 DPI. The image is a Bitmap and is sized at 500 width and 250 height.

我第一次使用第三方测试图像时,我的分辨率不正确。我只是使用 image.SetResolution(200,200)将其正确设置为200x200。但是,这只是改变了图像的分辨率标签并且没有正确,根据我的第三方技术联系人,调整图像的高度和宽度。

The first time I tested the images with the third party, my resolution was incorrect. I merely used image.SetResolution(200,200) to correctly set it to 200x200. This, however, only changed the resolution tag for the image and did not properly, according to my third party technical contact, adjust the image height and width.

我是否可以使用一个比率,以便对于每个X单位我增加分辨率,我只是增加相应的高度或宽度Y单位?我认为我可以增加分辨率而不必增加高度或宽度。

Is there a ratio that I can use so that for each X units I increment the resolution, I merely increment the corresponding height or width Y units? I thought that I could just increment resolution without having to increment height or width.

谢谢你,
Aaron。

Thank you, Aaron.

推荐答案

数字存储的图像没有有意义的DPI概念。在物理设备上再现图像时,DPI会起作用。

An image stored digitally has no meaningful concept of DPI. DPI comes into play when reproducing an image on a physical device.

您需要根据物理设备的DPI和所需的大小来调整图像大小。该设备上的输出。

You need to adjust the image size with regard to the DPI of the physical device, and the desired size of the output on that device.

例如,如果打印机告诉您需要300dpi的图像来填充4in x 4in的空间,那么您将为它们提供位图尺寸为1200x1200像素。在300dpi输出设备上,此图像的物理尺寸最终为4英寸x 4英寸。在600dpi设备上,相同的图像输出大小为2英寸x 2英寸。

For example, if a printer tells you they need an image at 300dpi to fill a space of 4in x 4in then you would provide them a bitmap with a size of 1200x1200 pixels. This image would end up with a physical size of 4in x 4in on a 300dpi output device. On a 600dpi device the same image would have an output size of 2in x 2in.

这篇关于根据高度/宽度C#设置图像DPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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