我如何才能找到一个JPG图片每英寸值的像素? [英] How can I find the pixel per inch value in a JPG image?

查看:523
本文介绍了我如何才能找到一个JPG图片每英寸值的像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想验证某些图像不允许超过每英寸300像素的图像低,有没有办法使用C#来找到它的ASP.NET?

I am trying to validate certain images to not allow images lower than 300 pixels per inch, is there a way to find it on ASP.NET using C#?

推荐答案

您已经有了从图像读取EXIF数据。

You've got to read EXIF data from the image.

在这里,你有你如何能做到它,使用ExifLib一个例子

Here you have an example of how you can do it, using ExifLib

ExifLib - 一种快速的Exif数据中提取用于.NET 2.0+

但是要注意,并不是所有的JPEG图像有分辨率信息。而且,即使他们拥有它,你可以使用一个完全不同的分辨率打印出来。即一个PIC 200像素宽的可使用1英寸宽打印为200DPI。使用2个英寸是100dpi的此相同的图像印刷,并采用1/2英寸400dpi的是

Be warned that not all jpeg images have the resolution information. And, that even if they have it, you can print them using a completely different resolution. I.e. a pic 200px wide can be printed using 1 inch width is 200dpi. This same image printed using 2 inches is 100dpi, and using 1/2 inch is 400dpi.

编辑:它来获得与本地.NET架构的 Image.PropertyItems物业

It's even possible to get this info with native .NET framework Image.PropertyItems Property

这篇关于我如何才能找到一个JPG图片每英寸值的像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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