MATLAB Answers

0

How to find or how to get image DPI ,without using imfinfo ? can anyone share idea's?

Asked by Selva Karna on 13 Jun 2018 at 7:05
Latest activity Edited by Walter Roberson
on 15 Jun 2018 at 16:59

How to find or how to get image DPI ,without using imfinfo ? can anyone share idea's?

  0 Comments

Sign in to comment.

2 Answers

Answer by Jan
on 13 Jun 2018 at 14:05

There i no general method to do this. At first you have to clarify what type of "images" your are talking of. If you e.g. have a photo of a ruler or a meter stick, you can count the pixels between marks. But if you have a PNG of a bird or a screenshot of a Matlab figure, what does "DPI" mean at all?

"DPI" is meaningful only, if you display the image, e.g. by showing it on the screen (then the DPI of the screen matters) or by printing it on paper. But of course you can print the same image on a paper with the double size using the half DPI value and get the same information.

Therefore I think, an image does not have a meaningful DPI value in general. Only printing to paper or to a EPS/PDF file define the DPI value uniquely. But then looking in the meta-data of the file is required.

So please explain which problem you want to solve actually. What is the problem with using imfinfo?

  2 Comments

Thanks Jan Sir.. how can get DPI resolution of Image. from bellow range, if i apply some process on IMAGE ,i got low DPI , so how can get Image DPI ,using IMFINFO, this command not giving a range of IMAGE DPI, so can you give a IDEAS Sir?

I have share here IMAGE RANGE bellow?

 if i apply some process on IMAGE ,i got low DPI

Which process to you apply? How do you determine, that you get a low DPI? Are you aware, that you can insert 1200 dpi in the header of the image without modifying the contents of the image in any kind? Only if you open it in a software and print it with the original resolution, you get a smaller image, but with exactly the same pixels.

Which problem do you try to solve?

Sign in to comment.


Answer by Walter Roberson
on 15 Jun 2018 at 16:50
Edited by Walter Roberson
on 15 Jun 2018 at 16:59

JPEG files do not have a built-in resolution property. There are some common extensions to JPEG usage that can be used to provide the information, especially EXIF.

http://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_JPEG_files

Unfortunately imwrite() has no way of writing EXIF data to JPEG files. https://www.mathworks.com/matlabcentral/answers/152559-writing-exif-data-to-jpg#answer_150208

As Jan points out, the resolution information is mostly informational. Most of the time it is wrong.

You should consider the JPEG resolution information as having only one purpose: namely that if you transmit a JPEG directly to your printer without using a print spooler (for example if you ftp the image to your printer) then the information will be used to figure out what printer DPI to use in printing the image. If you are using a print spooler, you should be setting parameters like "fit to page" or the like, and those parameters will override the resolution information stored in the JPEG file.

  0 Comments

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today