Borrar filtros
Borrar filtros

Resolution of an image

2 visualizaciones (últimos 30 días)
Salah Eddine
Salah Eddine el 4 de Oct. de 2012
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?

Respuestas (3)

Matt J
Matt J el 4 de Oct. de 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.

Image Analyst
Image Analyst el 4 de Oct. de 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.

Salah Eddine
Salah Eddine el 4 de Oct. de 2012
I am using imwrite() and the resolution changed. it was 300dpi and became 96dpi after using imwrite()
  1 comentario
Image Analyst
Image Analyst el 4 de Oct. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by