www.gusucode.com > images 案例代码 matlab源码程序 > images/ConvertBetweenGraphicsFileFormatsExample.m

    %% Convert Between Graphics File Formats
% This example shows how to convert between graphics file formats. To
% change the graphics format of an image, use |imread| to import the image
% into the workspace and then use |imwrite| to export the image, specifying
% the appropriate file format.
%%
% Read an image into the workspace. This example reads an image stored in a
% TIFF file.

% Copyright 2015 The MathWorks, Inc.

moon_tiff = imread('moon.tif');
%%
% Write the image data to a new file using JPEG format. For more
% information about how to specify a particular format when writing an
% image to a file, and other format-specific options, see the reference
% pages for |imread| and |imwrite|.
imwrite(moon_tiff,'moon.jpg');