how to set dpi of 300 of tiff image in matlab

32 views (last 30 days)
Hi every one; I have a tiff image which i have created in paint. I do not know its dpi value but i want to set its dpi value tp 300 , Please guide me whether matlab can set its dpi value to 300 or not?? I am asking about some kind of code which resolve my problem Thanks in advance
  2 Comments
Guillaume
Guillaume on 17 Jun 2015
Walter has shown you how to do it in matlab but why do you want to do it?
The dpi is just metadata associated to the image. It has no impact whatsoever on the content of the image. The only thing it does is give a hint to a printer what physical size the image should be. Most software will allow you to override that value in any case when you print.
Lauren Hirt
Lauren Hirt on 7 Dec 2017
Most likely for publication purposes. For instance, IEEE has strict standards on image quality therefore color images must have a 300 dpi when saved for submission.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Jun 2015
imwrite(TheImage, 'filename.tif', 'Resolution', 300)
  11 Comments
Guillaume
Guillaume on 17 Jun 2015
Edited: Guillaume on 17 Jun 2015
Well, Walter's code changes the dpi value associated with the image as requested. I would use his second example (the one with tiffObj) as it just touches the property of the image without the unnecessary load and save step.
But really, what your editor is asking is: does your image look good when printed at 300 dpi. That will only depends on how you generated your image to start with. If it's not good enough, there's probably not much you can do to make it look better other than recreate the image with a lot more details. Changing the dpi value of the image will not help in any way.
Walter Roberson
Walter Roberson on 18 Jun 2015
An important question here is: how did you generate the images? If your images are photographs generated by a scientific instrument, there may be good reason why they are exactly the the number of pixels they are, and the only thing that needs to be done is set the resolution of 300 like I show above.
If, however, your images are the result of one of the plotting routines, or the result of a screen capture, then you should be generating them at higher resolution. For example if you used print() then you should use the '-r300' option to create them at 300 dpi.
When printed in the book, how large do you want the images to come out? If you want the printed size to come out as 1.62 inches by 2.73 inches then you are fine, just set the Resolution like I show above. But if you want them to come out larger then you need more pixels in the image so that when printed at 300 dpi it comes out the desired size. To increase the number of pixels the best is to start with a source that has more pixels. If you are using a graphics plot then generate it at higher resolution as mentioned above. If you are working with a photo and there just isn't any more information available, then you will need to resize the image, which is something that is likely to introduce artifacts. But if that's what you need to do, have a look at the discussion over There

Sign in to comment.

More Answers (1)

ABHILASH SINGH
ABHILASH SINGH on 10 Apr 2017
print(gcf, '-dtiff', 'myfigure.tiff');

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!