check DPI when uploading an Image

2
Hi, I have an application where I would like to check the DPI (Dots Per Inch) of an image after I have uploaded the image. I would like to validate that an image has at least 300DPI before processing it. Is this possible? Han Pieter
asked
3 answers
4

An image itself has no DPI*!!

An image has only a resolution in pixels. DPI can only be calculated if you have the measurement of the paper where you want to print the image on. For example if your image is 500 x 500 pixels and you want to print it on a paper of 2 inch x 2 inch, the DPI** of the printed(!) image = 250 (-> 500 / 2). So the DPI is completely dependent of the size you want to print the image on (printing can also be exporting to PDF) and the resolution of the image.

So you can check with Java for a minimum resolution. The minimum can be calculated if you have the measurements in inches of your pdf document / physically paper.

*The confusing point is that an image have a EXIF DPI header, but that is nothing more that a valueless default value of a camera or a graphic edit program (I would spare you the details).

**Actually DPI is not a good term in this case, PPI (pixels per inch) is in this case better.

answered
1

You might be able to do this with a java action. I think you should google for this question, its not very Mendix related. stackoverflow.com will probably tell you more.

answered
1

An image itself has no DPI*!!

An image has only a resolution in pixels. DPI can only be calculated if you have the measurement of the paper where you want to print the image on. For example if your image is 500 x 500 pixels and you want to print it on a paper of 2 inch x 2 inch, the DPI** of the printed(!) image = 250 (-> 500 / 2). So the DPI is completely dependent of the size you want to print the image on (printing can also be exporting to PDF) and the resolution of the image.

So you can check with Java for a minimum resolution. The minimum can be calculated if you have the measurements in inches of your pdf document / physically paper.

*The confusing point is that an image have a EXIF DPI header, but that is nothing more that a valueless default value of a camera or a graphic edit program (I would spare you the details).

**Actually DPI is not a good term in this case, PPI (pixels per inch) is in this case better.

answered