Purpose
Saves an image of a window to a file; corresponds to clicking the Save command. This statement is used to save a Map window in raster and vector image formats. MapBasic supports raster image translucency. As of version 10.0 and later MapBasic supports translucency for vector images and the EMF+ and EMF+Dual image formats.
Supported vector formats are WMF, EMF, EMF+ and EMF+Dual. WMF and EMF are based on the same older technology used for non-enhanced windows. They display translucent vector maps, but they will appeared dithered, not as a true translucent image. EMF+, using enhanced rendering technology, will display translucent maps very well. EMF+Dual is a file that contains both an EMF and an EMF+ image.
Many older applications cannot read EMF+. The application tries to open it as an EMF (because the extension is EMF), and fails. EMF+Dual format is a compromise; older applications can open it as an EMF while newer applications can open it as an EMF+. For example, Office 2000 applications can read EMF, but not EMF+. Office 2007 reads EMF+.By saving the windows as EMF+Dual, both applications can read the same image.
MapInfo Pro reads all supported image formats with the exception of EMF+. All images display as raster images (including WMF and EMF).
Syntax
Save Window window_id
As filespec
Type filetype
[ Width image_width [ Units paper_units ] ]
[ Height image_height [ Units paper_units ] ]
[ Resolution output_dpi ]
[ Copyright notice [ Font... ] ]
window_id is an integer Window ID representing a Map, Browse, Graph, Layout, Statistics, Info, or Ruler window; to obtain a window ID, call a function such as the FrontWindow() function or the WindowID() function.
filespec is a string representing the name of the file to create.
filetype is a string representing a file format. File formats in this list marked with an astrix (*) are not supported when saving a Legend window.
- "BMP" that specifies Bitmap format
- "WMF" that specifies Windows Metafile format *
- "JPEG" that specifies JPEG format
- "JP2" that specifies JPEG 2000 format *
- "PNG" that specifies Portable Network Graphics format
- "TIFF" that specifies TIFF format
- "TIFFCMYK" that specifies TIFF CMYK format
- "TIFFG4" that specifies TIFFG4 format
- "TIFFLZW" that specifies TIFFLZW format
- "GEOTIFF" that specifies georeferenced TIFF format *
- "GIF" that specifies GIF format
- "PSD" that specifies Photoshop 3.0 format *
- "EMF" that specifies Windows Enhanced Metafile format *
- "EMF+" that specifies Windows EMF+ format *
- "EMF+DUAL" that specifies a file format containing both EMF and EMF+ formats in a single file *
image_width is a number that specifies the desired image width.
image_height is a number that specifies the desired image height.
paper_units is a string representing a paper unit name: cm (centimeters), mm (millimeters), in (inches), pt (points), and pica.
- 1 inch (in) = 2.54 centimeters , 254 millimeters, 6 picas, 72 points
- 1 point (pt) = 0.01389 inches, 0.03528 centimeters, 0.35278 millimeters, 0.08333 picas
- 1pica = 0.16667 inches, 0.42333 centimeters, 4.23333 millimeters, 12 points
- 1 centimeter (cm) = 0.39370 inches, 10 millimeters, 2.36220 picas, 28.34646 points
- 1 millimeter (mm) = 0.1 centimeters, 0.03937 inches, 0.23622 picas, 2.83465 points
output_dpi is a number that specifies the output resolution in DPI (dots per inch).
notice is a string that represents a copyright notice; it will appear at the bottom of the image.
The Font clause specifies a text style.
Description
The Save Window statement saves an image of a window to a file. The effect is comparable to the user clicking the Save command, except that the Save Window statement does not display a dialog box. For Map, Layout, or Graph windows, the default image size is the size of the original window. For Legend, Statistics, Info, or Ruler windows, the default size is the size needed to represent all of the data in the window. Use the optional Width and Height clauses to specify a non-default image size. Resolution allows you to specify the dpi when exporting images to raster formats. The Font clause specifies a text style in the copyright notice.
To include a copyright notice on the bottom of the image, use the optional Copyright clause. See the example below. To eliminate the default notice, specify a Copyright clause with an empty string ("").
Error number 408 is generated if the export fails due to lack of memory or disk space. Note that specifying very large image sizes increases the likelihood of this error.
Examples
This example produces a Windows metafile:
Save Window i_mapper_ID As "riskmap.wmf" Type "WMF"
This example shows how to specify a copyright notice. The Chr$() function is used to insert the copyright symbol.
Save Window i_mapper_ID As "riskmap.bmp"
Type "BMP"
Copyright "Copyright " + Chr$(169) + "2014, Precisely "
See Also:
Export statement