Drawing a Raster Image

Try it.

%!PS-Adobe-3.0

% A simple smiley face

gsave                  % We're mucking about with graphics state... save the original
  72 72 translate      % position the lower left at (72, 72)
  72 72 scale          % make the image 1 inch square
  8                    % 8 columns in the image
  8                    % 8 rows in the image
  1                    % 1-bit per pixel: black and white
  [8 0 0 8 0 0]        % map the unit square to (0, 0) - (8, 8)
  {<c3bd665a7e5abdc3>} % the image data as a hex-encoded string
  image                % actually draw the image
grestore

% A 16-shade horizontal gradient

gsave
  216 72 translate     % lower-left of images at (216, 72)
  72 144 scale         % size of rendered image is 72 points by 72 points
  16                   % 16 pixels wide
  1                    % 1 pixel high
  4                    % 4 bits per pixel
  [16 0 0 1 0 0]       % transform array... maps unit square to pixels
  {<0123456789ABCDEF>} % the image data itself
  image                % let's draw!
grestore

% A 16-tone color gradient from green to blue

gsave
  360 72 translate
  72 144 scale         % size of rendered image is 72 points by 72 points
  16                   % number of samples per line
  1                    % number of lines
  4                    % bits per color channel (1, 2, 4, or 8)
  [16 0 0 1 0 0]       % transform array... maps unit square to pixels
  {<0000000000000000>} % the red image data
  {<FEDCBA9876543210>} % the green image data
  {<0123456789ABCDEF>} % the blue image data
  true                 % pull channels from separate sources

  colorimage
grestore