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 téléchargements
Mise à jour 1 sept. 2016

Afficher la licence

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);

Citation pour cette source

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

Compatibilité avec les versions de MATLAB
Créé avec R2007a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Images dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.1

Updated license

1.0.0.0