output image with 650 dpi resolution

Hello, I ran across the following issue and hope someone can help me to solve it. Thank advance!
The matlab version I used is 2012b. The Linux machine I used is running on CentOS release 6.5. After I generate a figure, I want to output the figure to an image file (jpeg) with 650 dpi resolution by using the following command:
print(gcf,'-djpeg','-r650','figname.jpeg');
After the image was generated, I checked the image's resolution and it is 96 dpi, rather than 650 dpi. I have searched from Mathworks website and found the exchange code "export_fig" can output image with high resolution. I downloaded and installed "export_fig" package and ran the following command (as suggested by Dr. Rich Signell from USGS):
export_fig figname.jpeg -painters -r650;
The generated image is still with 96 dpi.
By the way, if I started matlab in the cron (background) to run the same code, the generated image has 72 dpi, neither 96 dpi nor 650 dpi.
Does someone have the same experience? If yes, how to solve this issue? Your comments or helps are greatly appreciated.

Answers (1)

Guillaume
Guillaume on 6 Oct 2014
The dpi (-r) setting affects the size in pixels of the output image. If you use '-r100' for example, you'll get a much smaller image (less pixels).
For on-screen display the dpi that is embedded in the does not really matter, just the number of pixels. An image with 96 dpi will display just the same as an image with 650 dpi. Even, when printing, the dpi may not matter, depending on the program used to print.

2 Comments

Please, reply via comments, not through private email.
Yes, the dpi value that is saved in the output image has actually no bearing on the actual quality of the image. Some image formats don't even store a dpi value. If you use -r650 to create the image it will have a much better quality than if you'd use -r96.
Thank you for your helpful comment.

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 6 Oct 2014

Commented:

on 6 Oct 2014

Community Treasure Hunt

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

Start Hunting!