SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2 Reference

Previous Page | Next Page

SAS/GRAPH Colors and Images

Specifying Images in SAS/GRAPH Programs

SAS/GRAPH software enables you to display images as part of your graph. You can place an image in the background area of a graph, in the backplane of graphs that support frames, or on the bars of two-dimensional bar charts. You can also apply images at specified graph-coordinate positions using the Annotate facility or the DATA Step Graphics Interface (DSGI).

The images you add to your graphs can be SAS files or external files in a wide range of image formats. If you wish to withold images from your graphics output, you can specify the NOIMAGEPRINT graphics option.


Image File Types Supported by SAS/GRAPH

For displaying images in your graphs, SAS/GRAPH software supports the following image file types:

File Type Description
BMP (Microsoft Windows Device Independent Bitmap) supports color-mapped and true color images stored as uncompressed or run-length encoded. BMP was developed by Microsoft Corporation for storing images under Windows 3.0.
CAT (SAS Catalog IMAGE entry) supports color-mapped images as well as true color images. The images can be optionally compressed.
DIB (Microsoft Windows Device Independent Bitmap) see the description of BMP.
EMF (Microsoft NT Enhanced Metafile) supported under Windows 95, Windows 98, Windows 2000, and Windows NT.
GIF (Graphics Interchange Format) supports only color-mapped images. GIF is owned by CompuServe, Inc.
JPEG (Joint Photographic Experts Group) supports compression of images with the use of JPEG File Interchange Format (JFIF) software. JFIF software is developed by the Independent Joint Photographic Experts Group.
PBM (Portable Bitmap Utilities) supports gray, color, RGB, and bitmap files. The Portable Bitmap Utilities is a set of free utility programs that were primarily developed by Jeff Poskanzer.
PCD (Photo CD) Kodak Photo CD format which supports multiple image resolutions.
PCL (Printer Control Language) developed by HP.
PCX (PC Paintbrush) supports bitmap, color-map, and true color images. PCX and PC Paintbrush are owned by Zsoft Corporation.
PNG (Portable Network Graphic) supports truecolor, gray-scale, and 8-bit images.
PS (PostScript Image File Format) the Image classes use only PostScript image operators. A level II PS printer is required for color images. PostScript was developed by Adobe Systems, Inc.
TGA (Targa) supports both true color images and color-mapped images; however, the current release of the Image classes supports only true color TGA files. Targa is owned by Truevision, Inc.
TIFF (Tagged Image File Format) internally supports a number of compression types and image types, including bitmap, color-map, gray-scale, and true color. TIFF was developed by Aldus Corporation and Microsoft Corporation and is used by a wide variety of applications.
WMF (Microsoft Windows Metafile) supported only under Microsoft Windows operating systems.
XBM (X Window Bitmaps) supports bitmap images only. XBM is owned by MIT X Consortium.
XPM (X Window Pixmap) is an extended version of XBM that supports color bitmaps.
XWD (X Window Dump) supports all X visual types (bitmap, color-map, and true color.) XWD is owned by MIT X Consortium.


Reading and Writing Image File Types

The Image File Types Supported by SAS/GRAPH may be supported for reading or writing. In addition, all SAS/GRAPH supported file types can be printed. The printed output's appearance is dependent on the driver that is selected. See Image Formats for Reading and Image Formats for Writing for more information on specific file type capabilities and attributes.

When you are reading some images, the FORMAT= attribute is required. See Including the FORMAT= attribute for more information. Some of the file types that require the FORMAT= attribute are only supported by certain hosts. Image File Types Supported Only on Certain Hosts contains information on these file types, the reader and writer attributes, and the host support.

If you are using SAS/GRAPH on the z/OS platform, you must be running the UNIX System Services Hierarchical File System (HFS) to read and write image files.


Including the FORMAT= attribute

When you are reading images, include the FORMAT= attribute if

FORMAT= is not required in other cases, but it is always more efficient to specify it.

Image Formats for Reading

The following table describes the attributes for the image readers that are supported by SAS/GRAPH:

Image Formats for Reading
File Type Reader Attributes Comment
BMP FORMAT=BMP

COMPRESS=NONE

COMPRESS=RLE


is the default. Sets compression to run-length encoded.

CAT FORMAT=CAT
DIB FORMAT=DIB is supported only by Windows NT, Window 2000, and Windows XP.
EMF FORMAT=EMF is supported only by Windows NT, Window 2000, and Windows XP.
GIF FORMAT=GIF
JFIF FORMAT=JFIF required for reading JPEG files that use JPEG File Interchange Format (JFIF).

DCT=mode selects specific type of Discrete Cosine Transform (DCT) to use when processing the image; mode can be
  • INT -- an integer DCT

  • FAST -- a faster and less accurate integer DCT

  • FLOAT -- a slightly more accurate method that can be slower unless the host has very fast floating point hardware.


GRAYSCALE produces a gray-scale image even if the JPEG file is in color. This is useful for viewing on monochrome displays. The reader runs noticeably faster in this mode.

VERSION prints the version number and copyright messages for the Independent JPE Group's JFIF software to the log.

FAST enables certain recommended processing options for fast, low quality output; equivalent to enabling ONEPASS, DITHER=ORDERED, COLORS=216, NOSMOOTH, and DCT=FAST.

NOSMOOTH uses a faster, lower quality, upsampling routine.

ONEPASS uses a one-pass color quantization instead of the standard two-pass quantization. The one-pass method is faster and needs less memory, but it produces a lower-quality image. This attribute is ignored unless you also specify the COLORS attribute. ONEPASS is always enabled for gray-scale output.

COLORS=n reduces the number of colors in the image to at most n colors; n must be in the range 2...256.

SCALE_RATIO=n scales the output image by a factor of 1/n. Currently the scale factor must be 1/1, 1/2, 1/4, or 1/8. This is useful when processing a large image and only a smaller version is needed, as the reader is much faster when scaling down the output.

DITHER=mode selects the specific type of dithering to use color quantization; mode can be
  • FS -- Floyd-Steinberg dithering

  • ORDERED -- ordered dithering

  • NONE -- no dithering.

PBM FORMAT=PBM
PCD FORMAT=PCD specifies photo CD format. FORMAT=PCD RES= specifies the image resolution to be read. Photo CD images have multiple resolution images in each image. Values are:
BASE/64

64x96

BASE/16

128x192

BASE/4

256x384

BASE

512x768 (default)

4BASE

1024x1536

16BASE

2048x3072.

PCX FORMAT=PCX is not supported for writing.
PNG FORMAT=PNG
TGA FORMAT=TGA
TIFF FORMAT=TIFF
XBM FORMAT=XBM
XPM FORMAT=XPM is supported only under the X Windows System under UNIX.
XWD FORMAT=XWD


Image Formats for Writing

The following table describes the attributes for the image writers that are supported by SAS/GRAPH:

Image Formats for Writing
File Type Writer Attributes Comment
BMP FORMAT=BMP
CAT FORMAT=CAT

COMPRESS=G3FAX sets compression to FAX CCITT Group 3 for monochrome black-and-white images (depth of 1) only.

COMPRESS=G4FAX sets compression to FAX CCITT Group4 for monochrome black-and-white images (depth of 1) only.

DESC= enables description for catalog description
DIB FORMAT=DIB is supported only by Windows NT, Window 2000, and Windows XP.
EMF FORMAT=EMF is supported only by Windows 95, Windows 98, Windows 2000, and Windows NT.
GIF FORMAT=GIF
JFIF FORMAT=JFIF is required for writing JPEG files that use JPEG File Interchange Format (JFIF).

DCT=mode selects specific type of Discrete Cosine Transform (DCT) to use when processing the image; mode can be
  • INT -- an integer DCT

  • FAST -- a faster and less accurate integer DCT

  • FLOAT -- a slightly more accurate method that can be slower unless the host has very fast floating point hardware.


GRAYSCALE produces a gray-scale image even if the JPEG file is in color. This is useful for viewing on monochrome displays. The writer runs noticeably faster in this mode.

VERSION prints the version number and copyright messages for the Independent JPE Group's JFIF software to the log.

FAST enables certain recommended processing options for fast, low quality output; equivalent to enabling ONEPASS, DITHER=ORDERED, COLORS=216, NOSMOOTH, and DCT=FAST.

NOSMOOTH uses a faster, lower quality, upsampling routine.

ONEPASS uses a one-pass color quantization instead of the standard two-pass quantization. The one-pass method is faster and needs less memory, but it produces a lower-quality image. This attribute is ignored unless you also specify the COLORS attribute. ONEPASS is always enabled for gray-scale output.

COLORS=n reduces the number of colors in the image to at most n colors; n must be in the range 2...256.

SCALE_RATIO=n scales the output image by a factor of 1/n. Currently the scale factor must be 1/1, 1/2, 1/4, or 1/8. This is useful when processing a large image and only a smaller version is needed, as the writer is much faster when scaling down the output.

DITHER=mode selects the specific type of dithering to use color quantization; mode can be
  • FS -- Floyd-Steinberg dithering

  • ORDERED -- ordered dithering

  • NONE -- no dithering.

PBM FORMAT=PBM

COMPRESS=NONE creates a text PBM file.

COMPRESS=BINARY | RAW if either of these values is specified, creates a PBM file of reduced size by packing the pixels as binary data (when FORMAT=PBM is specified, output is produced by default as if one of these values is specified).
PCL FORMAT=PCL

DPI=num specifies the number of dots per inch to use to calculate the visual size of the image on the PostScript page in the output file. The default is 300. For example, a 600-pixel by 600-pixel image appears as a 2-inch by 2-inch image on the PostScript page if you use the default setting.

EPS does not reset the printer margins; use to embed an image into another PCL document
PNG FORMAT=PNG
PS FORMAT=PS

COMPRESS=NONE is the default for color images.

COMPRESS=RLE sets compression to run-length encoded; default for gray-scale images.

DPI=num specifies the number of dots per inch to use to calculate the visual size of the image on the PostScript page in the output file. The default is 300. For example, a 600-pixel by 600-pixel image appears as a 2-inch by 2-inch image on the PostScript page if you use the default setting.

EPS