Chapter Contents

Previous

Next
Image Data Model: _copy

Image Data Model: _copy



Copies images


Syntax
Details
Example

Syntax

CALL SEND (source-object-id, '_copy', destination-object-id);

Argument Type Description
source-object-id
N the identifier of the image to be copied
destination-object-id
N the identifier of the destination image


Details

You must define the destination object with the LOADCLASS and INSTANCE functions before applying the _copy method. Because _copy creates another copy of the image in memory, you should delete the destination object when you are finished using it.


Example

This example reads in an image, scales it to 400×400, and stores it as a GIF file. A copy of the image is then scaled to a 48×48 black-and-white image, and stored as a compressed TIFF file.

init:
   image_class = loadclass('sashelp.fsp.
                            imgdat.class');
   filename='/usr/images/color/sign.gif';
   link process;
return;

process:
   src_object = instance(image_class);
   call send(src_object, '_read',
             filename);
   link icon;

   call send(src_object, '_scale',
             400, 400);
   call send(src_object, '_write',
            'scale400.gif', 'format=gif');
return;

   /* Copy the source image object to a
      temporary object to           */
   /* manipulate it.  This allows us to
      process the same image twice  */
   /* without having to reread it from disk
      each time.  Note that if  */
   /* the 'icon' routine were to be called
      more than once, it would   */
   /* be more efficient to create only a single
     'temp_object' in the  */
   /* init code and reuse it each time instead
      of creating a new      */
   /* instance each time.                                             */
icon:
   temp_object = instance(image_class);
   call send(src_object, '_copy',
             temp_object);
   call send(temp_object, '_scale', 48, 48);
   call send(temp_object, '_ditherBw');
   call send(temp_object, '_write',
            'icon.tif',
             'format=tiff compress=g3fax');
   call send(temp_object, '_term');
return;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.