Resolution of an image
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I wrote a code to process a personal image. I want the background to be white. The program does the stuff, but when the new image is written to a file, the resolution changes, in the original image it is 300dpi and it becomes 96dpi in the new image. I want to have the new image with 300dpi resolution and in sRGB not just RGB. How to do it please?
0 commentaires
Réponses (3)
Matt J
le 4 Oct 2012
The following section of the PRINT command documentation might apply to you. You would use the -r flag:
Options for PostScript, GhostScript, Tiff, Jpeg, and Metafile:
-r<number> % Dots-per-inch resolution. Defaults to 90 for Simulink,
150 for figures in image formats and when
printing in Z-buffer or OpenGL mode, screen
resolution for Metafiles and 864 otherwise.
Use -r0 to specify screen resolution.
0 commentaires
Image Analyst
le 4 Oct 2012
How are you writing the image? If you use imwrite() it will not change the resolution. If you need to save other stuff like arrows, text, tick marks etc. in the figure, then use export_fig, like mentioned in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions. It's the #1 most downloaded File Exchange submission (for good reason). With it you can specify the resolution.
0 commentaires
Salah Eddine
le 4 Oct 2012
1 commentaire
Image Analyst
le 4 Oct 2012
imwrite normally just writes out pixel for pixel. The dpi information is not getting saved, and whatever program you open it back up with again assigns a default of 96 dpi. Perhaps one of the options for whatever format you're using will let you specify the dpi. What format is it? Have you looked at all the options for that format? For example "resolution" for TIFF images, and XRresolution and YResolution and ResolutionUnit for PNG images. You might also look to the TIFF class for more options than imwrite, if you can use TIFF images.
Voir également
Catégories
En savoir plus sur Printing and Saving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!