5.0

5.0 | 1 rating Rate this file 45 downloads (last 30 days) File Size: 4.29 KB File ID: #25595

IMWRITESIZE Write image file with specified width and resolution

by Steve Eddins

 

16 Oct 2009

Code covered by the BSD License  

Write a TIFF or PNG image file with specified width (inches) and resolution (dpi).

Download Now | Watch this File

File Information
Description

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

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Other Files imwritesize/imwritesize.m,
imwritesize/tests/test_imwritesize.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
10 Nov 2009 Yufei  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
image file Steve Eddins 04 Nov 2009 09:02:14
tiff Steve Eddins 04 Nov 2009 09:02:14
png Steve Eddins 04 Nov 2009 09:02:14
resolution Steve Eddins 04 Nov 2009 09:02:14
dpi Steve Eddins 04 Nov 2009 09:02:14
width Steve Eddins 04 Nov 2009 09:02:14
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com