![]()
The following raster editing commands are available for use in a Command File.
NegateNo arguments. Negates the currently loaded raster image. See Negate.
MirrorVertNo arguments. Mirrors the currently loaded raster image vertically.
MirrorHorizNo arguments. Mirrors the currently loaded raster image horizontally.
Rotate or RotateRasterDegrees One argument. Rotate the currently loaded raster image by the number of Degrees you specify. If you enter a positive angle, the image will be rotated in a clockwise direction. If you enter a negative angle, it will be rotated in an anti clockwise direction. The following example code rotates the raster image clockwise by 90 degrees: ROTATE 90
AutoDeskewNo arguments. Automatically deskews the currently loaded raster image. Only 1 Bit (black and white) images are affected by this command. You can ensure that an image is 1 Bit by using the ReduceColorDepth1Bit command before using AutoDeskew.
Scale or ScaleNearest
Two arguments. Scales the currently loaded raster image vertically and/or horizontally. The following example code scales the image by a factor of 2 in both the X and Y directions: SCALE 2 2
ScaleTile
Two arguments. Scales the currently loaded raster image vertically and/or horizontally. The following example code scales the image by a factor of 2 in both the X and Y directions: SCALETILE 2 2
ScaleBicubic
Two arguments. Scales the currently loaded raster image vertically and/or horizontally. The following example code scales the image by a factor of 2 in both the X and Y directions: SCALEBICUBIC 2 2
ScaleBilinear
Two arguments. Scales the currently loaded raster image vertically and/or horizontally. The following example code scales the image by a factor of 2 in both the X and Y directions: SCALEBILINEAR 2 2
ScaleBspline
Two arguments. Scales the currently loaded raster image vertically and/or horizontally. The following example code scales the image by a factor of 2 in both the X and Y directions: SCALEBSPLINE 2 2
ThresholdSimple
One argument. Uses a simple threshold to threshold the currently loaded raster image. All pixels with a color value less that the threshold value are set to black. All pixels with a color value greater that the threshold value are set to white. Only 4 Bit (16 color) and 8 Bit (256 color and grayscale) images are affected by this command. 24 Bit (16.7 million color) images are automatically converted to grayscale before thresholding. After the threshold, you may want to reduce the color depth of the thresholded image to 1 Bit (black and white) using the ReduceColorDepth1Bit command. The following example thresholds the image then reduces its color depth. THRESHOLDSIMPLE 127 REDUCECOLORDEPTH1BIT
ThresholdAdaptive
Two arguments. Uses an adaptive threshold to threshold the currently loaded raster image Only 4 Bit (16 color) and 8 Bit (256 color and grayscale) images are affected by this command. 24 Bit (16.7 million color) images are automatically converted to grayscale before thresholding. After the threshold, you may want to reduce the color depth of the thresholded image to 1 Bit (black and white) using the ReduceColorDepth1Bit command. The following example thresholds the image then reduces its color depth. THRESHOLDADAPTIVE 20 17 REDUCECOLORDEPTH1BIT
DetectEdgesNo arguments. Deletes solid areas of color, leaving just the boundaries between them. See Detect Color Edges. The following example code detects the edges between white and colored areas of the image: DETECTEDGES
The following example code detects the edges between all the colors on the image: * Reduce the color depth of the raster image to 256 colors REDUCECOLORDEPTH8BIT * Detecting the edges between hundreds of colors will probably * give meaningless results, so reduce the palette to a sensible level REDUCECOLORSAUTO16 * Activate Layer Colors COLORLAYERSON * Smooth the edges between the colors SMOOTH * Detect the edges between the colors DETECTEDGES * Remove speckles from the detected edges REMOVESPECKLES 6
RemoveSpeckles
One argument. Cleans the currently loaded raster image by removing speckles from it. See Remove Speckles. The following example code removes speckles of any color if they are smaller than 6 pixels in size and completely surrounded by white: REMOVESPECKLES 6
The following example code removes speckles of any color if they are smaller than 6 pixels in size, regardless of the background color they are on: * Reduce the color depth of the raster image to 256 colors REDUCECOLORDEPTH8BIT * Activate Layer Colors COLORLAYERSON * Remove speckles REMOVESPECKLES 6
RemoveHoles
One argument. Cleans the currently loaded raster image by removing white holes from it. See Remove Holes. The following example code removes white holes if they are smaller than 6 pixels in size: REMOVEHOLES 6
ThinStandard
One argument. Thins the currently loaded raster image with a bias towards retaining curves. See Thin Standard. The following example code thins the raster image by 9 pixels: THINSTANDARD 9
ThinOrtho
One argument. Thins the currently loaded raster image with a bias towards retaining orthogonal lines. See Thin Ortho. The following example code thins the raster image by 9 pixels: THINORTHO 9
ThickenLinesNo arguments. Thickens the currently loaded raster image. See Thicken Lines.
ThickenPixels
One argument. Fills white pixels that are surrounded by a user-defined number of colored pixels. See Thicken Pixels. The following example code fills white pixels if they are surrounded by at least 2 colored pixels: THICKENPIXELS 2
SmoothNo arguments. Smooths the currently loaded raster image by removing “hairs” from it. If you are going to rotate the image, you should use Smooth before you rotate it. See Smooth. The following example code smooths entities that are on a white background: SMOOTH
The following example code smooths entities regardless of their background color: * Reduce the color depth of the raster image to 256 colors REDUCECOLORDEPTH8BIT * Activate Layer Colors COLORLAYERSON * Smooth SMOOTH
Outline
One argument. Deletes solid colored areas of pixels from the raster image to leave a raster outline. See Outline. The following example code deletes solid colored areas of pixels leaving an outline 2 pixels thick: OUTLINE 2
ForceToWhiteRangePercentage One argument. Makes the paper background white by forcing colors within a percentage range of white to white. You should always use ForceToWhite before converting a grayscale or color raster image to vectors unless you are converting a color image to color vectors using ColorLayersOn (see below). The RangePercentage value will be different depending on the raster image you are converting. To choose a suitable RangePercentage value you need to experiment with raster images similar to the ones you intend to convert using the Command File, as follows:
The Reduce Colors dialog appears.
All the colors within the percentage range you have chosen are selected.
The selected colors are made white.
If parts of the image have disappeared the percentage you typed was too high. Return to Step 1 and try again with a lower percentage.
If no vectors appear on the image, or a single straight line vector appears along the edge(s) of the image, or vectors appear over the paper area of the image, the percentage you typed was too low. Return to Step 1 and try again with a higher percentage. The following example code converts a grayscale or color raster image to vectors, ignoring color: * Make the paper background white FORCETOWHITE 15 * Select suitable vectorization settings TYPECONTOUR * Vectorize the image RUNVECTOR
ReduceColorsAuto256No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 256. See Reduce colors automatically.
ReduceColorsAuto128No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 128.
ReduceColorsAuto64No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 64.
ReduceColorsAuto32No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 32.
ReduceColorsAuto16No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 16.
ReduceColorsAuto8No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 8.
ReduceColorsAuto4No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 4.
ReduceColorsAuto2No arguments. Automatically reduces the number of colors used on the currently loaded raster image to 2.
LoadPalettePaletteFileName One argument. Loads a palette. See Change the palette. The following example code loads the AutoCAD palette and maps the colors in the currently loaded raster image to their nearest AutoCAD equivalents. LOADPALETTE c:\program files\scan2cadv8\palettes\autocad.pal
ReduceColorDepth8BitNo arguments. Reduces the color depth of the currently loaded raster image to 8 Bit (256 colors).
ReduceColorDepth4BitNo arguments. Reduces the color depth of the currently loaded raster image to 4 Bit (16 colors).
ReduceColorDepth1BitNo arguments. Reduces the color depth of the currently loaded raster image to 1 Bit (2 colors – � black and white).
ColorLayersOn (replaces ColorSeparationOn)ColorSeparationOn No arguments. Activates Color Layers. All colors on the currently loaded raster image are automatically selected as Layer Colors – it is not currently possible to select individual Layer Colors from the Command File. ColorLayersOn does not work on 24 Bit images. Before using ColorLayersOn you must use one of the ReduceColorDepth commands to reduce color depth to 8 Bit or less. For sensible results you should also use one of the ReduceColorsAuto commands to reduce the number of colors used on the image to the minimum that is appropriate for the images. The following example code converts a color raster image to color vectors: * Load the raster image map.tif LOADRASTER c:\users\username\documents\scan2cadv8\samples\map.tif * Reduce the color depth of the raster image to 256 colors REDUCECOLORDEPTH8BIT * Reduce the number of colors used on the image to a level suitable for that image REDUCECOLORSAUTO4 * Activate Layer Colors COLORLAYERSON * Select suitable vectorization settings TYPECONTOUR * Vectorize the image RUNVECTOR * Save the vectors as map.dxf SAVEVECTOR * Exit Scan2CAD EXIT
ColorLayersOff (replaces ColorSeparationOff)ColorSeparationOffNo arguments. Deactivates Layer Colors.
|
Raster editing commands
Have questions on this topic? Talk to us