简体   繁体   English

图像的DPI

[英]DPI of an image

I have a requirement where I have to check the DPI of a bunch of images stored in an oracle database as a blob and make sure they are above 300 dpi. 我有一个要求,我必须检查以blob形式存储在oracle数据库中的一堆图像的DPI,并确保它们高于300 dpi。 I was planning on reading the field via ac# program and trying to determine their dpi, but i was unsure how to calculate this. 我打算通过ac#程序阅读该字段并尝试确定其dpi,但是我不确定如何计算该值。 Can anyone give me some guidance on how I can determine their DPI. 谁能给我一些有关如何确定其DPI的指导。

As the name says, DPI represents the number of pixels per inch. 顾名思义,DPI代表每英寸的像素数。 To calculate it you need the size of image in inchs and in pixels. 要计算它,您需要以英寸和像素为单位的图像大小。 The size in inchs is relative to the monitor screen dpi, best resolutions like printers use more points for inch. 以英寸为单位的尺寸是相对于显示器屏幕dpi而言的,像打印机这样的最佳分辨率使用的英寸数更多。

样品:

So, if your image has 100px and 2in, your dpi is 100/2 = 50 dpi. 因此,如果您的图像具有100px和2in,则dpi为100/2 = 50 dpi。 Realize that the problem is how to determine the size in inchs of your image if basically you need to get an reference of inchs. 意识到问题在于,如果基本上需要获取英寸参考,则如何确定图像的英寸大小。

Then, would be easier to verify the dpi of image on upload and guarantee the required before the insertion. 然后,将更容易验证上传图像的dpi并保证插入之前所需的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM