Release 11 New Features      

TIFF and JPEG Device Drivers

MATLAB 5.1 added new built-in device drivers for producing Tagged Image File Format (TIFF) and Joint Photographic Experts Group (JPEG) graphics files from MATLAB figures. These drivers are available on all platforms.

This table summarizes the command-line switches for these drivers.

Device
Description
-dtiff
TIFF with packbit compression
-dtiffnocompression
TIFF with no compression
-djpeg
Baseline JPEG, quality level 75
-djpegnumber
Baseline JPEG, quality level specified by number

Note These drivers work with MATLAB figures only. You cannot use these drivers to print Simulink models.

This section summarizes how to use these drivers with the print command.

TIFF

To produce a TIFF file from a MATLAB figure, use the -dtiff switch. For example, this command produces a TIFF file named newplot.tif from the current figure

You can use the -r option in conjunction with the -dtiff switch to specify the resolution of the output. For example,

If you do not specify the resolution, MATLAB uses the default resolution of 150 dots per inch.

Note that you must specify a filename because TIFF files cannot be sent directly to a printer. If you omit the filename, MATLAB assigns the file a name, such as figure1.tif. If you specify a filename that does not include the .tif extension, MATLAB appends the extension automatically.

The TIFF files that MATLAB produces are 24-bit truecolor bitmaps. MATLAB renders these graphics using the Z-buffer renderer, regardless of the setting of the figure Renderer property. If you use the -painters switch with the print command, the switch is ignored.

Compression

The TIFF output produced by -dtiff uses packbit compression, a lossless compression scheme that is supported by virtually all applications that can import TIFF graphics. If you need to import a TIFF file into an application that does not read packbit-compressed TIFF, use the -dtiffnocompression switch to produce an uncompressed TIFF file. (You can abbreviate this switch to
-dtiffn.) For example,

An uncompressed TIFF file is often much larger than the same file compressed. For certain plots, the uncompressed file may be more than 10 times the size of the compressed file. (The actual ratio will vary. The size of an uncompressed file depends only on the resolution and the width and height values in the PaperPosition figure property; the size of the compressed file also depends on the content of the figure.)

JPEG

To produce a JPEG file from a MATLAB figure, use the -djpeg switch. For example, this command produces a JPEG file named newplot.jpg from the current figure

You can you use the -r option in conjunction with the -djpeg switch to specify the resolution of the output. For example,

If you do not specify the resolution, MATLAB uses the default resolution of 150 dots per inch.

Note that you must specify a filename because JPEG files cannot be sent directly to a printer. If you omit the filename, MATLAB assigns the file a name such as figure1.jpg. If you specify a filename that does not include the .jpg extension, MATLAB appends the extension automatically.

The JPEG files that MATLAB produces are 24-bit truecolor bitmaps. MATLAB renders these graphics using the Z-buffer renderer, regardless of the setting of the figure Renderer property. If you use the -painters switch with the print command, the switch is ignored.

Compression

JPEG files use a lossy compression scheme that compresses files dramatically with relatively little loss of information. This scheme enables you to make tradeoffs between file size and quality, by specifying a quality level between 0 (minimum quality, maximum compression) and 100 (maximum quality, minimum compression). By default, -djpeg uses a quality level of 75; however, you can use a different level by appending the value to the device name. For example, this command produces a JPEG file with a quality level of 50

Even at the highest quality level, JPEG files are often highly compressed. In fact, depending on the figure, a JPEG file with a quality level of 100 may be considerably smaller than a packbit-compressed TIFF file of the same figure.



[ Previous | Next ]