SaveSampleToImage()
Summary
Saves a sample object to an image file.
Syntax
SaveSampleToImage(object sample, string file_name, string type, array options)
| Argument |
Contents |
| sample |
A sample object |
| file_name |
The path and name of the file |
| type |
The image file type: JPEG, BITMAP or PNG |
| Option |
Type |
Contents |
| Quality |
Integer |
Quality of the JPEG image. The higher the quality setting, the larger the resulting JPEG files |
| Border |
Boolean |
Whether to frame image with a border |
| Overlay |
Boolean |
Another sample to draw transparently over main sample (e.g. text label for highway shields) |
Example
// Create a Fill pattern and save it to sample image
map_layer_set = GetLayer() + "|"
options = {{"Shape","Fill"}} + options
{ line_width , line_style , line_color , fill_style , fill_color } = { GetLineWidth(map_layer_set) ,
GetLineStyle(map_layer_set) ,
GetLineColor(map_layer_set) ,
GetFillStyle(map_layer_set) ,
GetFillColor(map_layer_set)}
options = options + {{"Size", 64,64}}
sample= SampleArea(line_width,line_style,line_color,fill_style,fill_color,options)
fname = "c:\\foo\\sample.png"
SaveSampleToImage(sample, fname, "png", {{"Border","False"}, {"Size", 50,50}})
Error Codes
| Error Type |
Meaning |
| Error |
One of the options is not valid |
See Also
| Function |
Summary |
| GetSample() |
Gets a sample object indicating how features in a layer or selection set display on a map |
| GetThemeSamples() |
Gets sample objects indicating how features in a theme display on a map. |
| SamplePoint() |
Creates a sample point object for use in a menu or dialog box |
| SampleLine() |
Creates a sample line object for use in a menu or dialog box |
| SampleText() |
Creates a sample text object for use in a menu or dialog box |
| SampleArea() |
Creates a sample area object for use in a menu or dialog box |
| SetSampleText() |
Creates a sample object based on an input sample with the specified text for use in a menu or dialog box |