Commands Used with the IMGCTRL, IMGOP and PICFILL Functions |
Syntax | |
Details | |
Example |
Syntax |
rc=IMGOP(task-id, 'CREATE_IMAGE', width, height, type, depth<, color-map-len>); |
is the type of the image. These values match the values that QUERYN returns for type:
1 | |
2 | |
3 |
is the depth of the new image. The depth must match the value given for type, above.
is the number of colors in the color map. This value is used only with a type of 2 (CMAP). If not specified, it defaults to 256.
Details |
CREATE_IMAGE creates an "empty" image in which all data and color map values are set to 0 (black). You must use SET_COLORS to set the color map and use SET_PIXEL to set the pixel values. Note that processing an entire image in this manner can be very slow.
Example |
Copy an image. Note that the COPY command is a much faster way of doing this, and this example is here to show how to use the commands.
COPY: width=0; height=0; type=0; depth=0; cmaplen=0; r=0; g=0; b=0; pixel=0; pixel2=0; pixel3=0; task-id=imginit(0,'nodisplay'); task-id2=imginit(0,'nodisplay'); /* read and query original image */ rc=imgop(task-id,'READ','first.tif'); rc=imgop(task-id,'QUERYN','WIDTH',width); rc=imgop(task-id,'QUERYN','HEIGHT',height); rc=imgop(task-id,'QUERYN','TYPE',type); rc=imgop(task-id,'QUERYN','DEPTH',depth); rc=imgop(task-id,'QUERYN','COLORMAP_LEN', cmaplen); /* Create the new image */ rc=imgop(task-id2,'CREATE_IMAGE',width,height, type,depth); /* Copy the color map */ do i=0 to cmaplen-1; rc=imgop(task-id,'GET_COLORS',i,r,g,b); rc=imgop(task-id2,'SET_COLORS',i,r,g,b); end; /* Copy the pixels */ do h=0 to height-1; do w=0 to width-1; rc=imgop(task-id,'GET_PIXEL',w,h,pixel, pixel2,pixel3); rc=imgop(task-id2,'SET_PIXEL',w,h,pixel, pixel2,pixel3); end; end; /* Write out the new image */ rc=imgop(task-id2,'WRITE','second.tif', 'format=tif'); rc=imgterm(task-id); rc=imgterm(task-id2); return;
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.