IMWRITESIZE Write image file with specified width and resolution

Write a TIFF or PNG image file with specified width (inches) and resolution (dpi).
1,7K Descargas
Actualizado 1 sep 2016

Ver licencia

imwritesize(A, FILENAME, WIDTH) writes the image A to the specified FILENAME in either TIFF or PNG format. Resolution information is written into the file so that many document and graphics printing applications (e.g., Microsoft Word, Adobe Photoshop and Illustrator, PDFLaTeX) will treat the image as having the specified WIDTH in inches. The input image A can be either grayscale or RGB; indexed images are not supported.

If the specified FILENAME ends in .tif, .tiff, or .png, the appropriate file format will be used. Otherwise, the image will be written as a TIFF file using the specified FILENAME with no additional extension.

imwritesize(A, FILENAME, WIDTH, RESOLUTION) resizes the image A if necessary so that it can be written to the file with both the specified WIDTH in inches as well as the specified RESOLUTION in pixels per inch. (This syntax requires the Image Processing Toolbox.)
EXAMPLES

% Write out an image as a PNG file so that document and
% graphics applications will treat it as being 2 inches wide.
A = imread('rice.png');
imwritesize(A, 'rice_2in.png', 2);

% Write out an image as a TIFF file so that document
% and graphics applications will treat it as being
% 3.5 inches wide with a resolution of 300 dpi.
A = imread('rice.png');
imwritesize(A, 'rice_3.5in_300dpi.tif', 3.5, 300);

Citar como

Steve Eddins (2025). IMWRITESIZE Write image file with specified width and resolution (https://www.mathworks.com/matlabcentral/fileexchange/25595-imwritesize-write-image-file-with-specified-width-and-resolution), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2007a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Images en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.1

Updated license

1.0.0.0