Code covered by the BSD License  

Highlights from
IMWRITESIZE Write image file with specified width and resolution

5.0

5.0 | 4 ratings Rate this file 15 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

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

| 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)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
10 Nov 2009 Yufei  
08 Mar 2011 Arthur

Nice, thanks

19 Aug 2011 Alan

Very useful. Thanks for the great tool.

09 Jan 2012 Arun

awesome..it was very useful

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

Contact us at files@mathworks.com