Up | AccessControl | Shutdown | Profile | Backup | Curves | Delay | LogMsg | Console | QAlarm | QAlarmReset | RefCmds | InitSaveImage | SaveImage | Script | Start | Statistics | Stop | WebBrowser

 

  

 
SaveImage

Saves the shown images in Scorpion.

The command has two modes, 

  • fixed filename
  • auto saving 

Fixed filename is normally used when communicating with other systems, while auto saving is meant for image logging.

Filename consist of 3 elements separated by "_", SequenceNo_Comment_Index.bmp. SequenceNo is next number in image folder and index is the image number. Comment is user defined and will not be included if empty.

The InitSaveImage may be used to optimize saving of images in highspeed profiles.

Syntax :

SaveImage;<imageno=1..n>;<image=name>;<mask=value>;<filename=name>;<path=name>;
                  <comment=text>;<type=bmp|jpg>;<maxcount=value>;
                  <tag=text>;<tagsize=value>;<tagcolor=color>;<graphics=0/1>

where 
Parameter

Value

Description
imageno 1..n index of image to save
image string name of image to save
mask 1..n binary coded mask for images to save, i.e mask=9 (1001B) saves image 1 and 4. Mask overrides any image or imageno parameters
filename string if path is not given, filename can contain full path. Filename shall not be given if auto saving
path string full or relative path to image folder. Used if filename does not include path or path is not given (auto saving). Default path is <Profile Path>\Images

Path values with special meaning - expands to predefined Scorpion directories

 * path=PROFILE --> <profile>Images
 * path=2DCALIB --> <profile>\Calibration\Calib2D
 * path=3DCALIB --> <profile>\Calibration\Calib3D
 * path=STORAGE --> <storage>\Images
 * path=MIRROR --> <storage>\Mirror\Images
comment string comment field in filename
type BMP or JPG BMP or JPG, type is automatic detected if filename contains extension .bmp or .jpg
maxcount 1..n keeps max number of imagesets to avoid full disk (1..n).
compression 0..100 compression in range 0..100% - applicable when type=JPG
tag string saves a tag with date and time at bottom left corner of image
tagsize 1..n fontsize of tag, default=12
tagcolor string color of tag, default=white
graphics   saves the shown image with graphics as in the image popupmenu

note that saved image is exactly like displayed on the screen

  • The size of the image is given by the current size of the image on the screen.
  • This option requires Scorpion must be visible and topmost on the screen

If imageNo or image is omitted, all active images will be saved, inactive images is normally synthetic images generated from active images and is not necessary for later processing. Default filename in single image saving, i.e. imageNo or image but filename is omitted, filename will be image name. Inactive images will also be saved by this command. If filename contains extension the type will be set accordingly.

Note: Filenames when auto saving

When auto saving, i.e. the filename and imageno or image parameter is omitted, filename will be an increasing number :

[0001_0.bmp,0001_1.bmp..0001_n-1.bmp], [0002_0.bmp,0002_1.bmp..0002_n-1.bmp]-->

Example 1: Save Image with a fixed filename

SaveImage;path=c:\Images;filename=test;
SaveImage;imageno=1;filename=c:\images\image1.bmp
SaveImage;imageno=2;filename=c:\images\image2.bmp

Example 2: Save Image with a fixed filename

Automatic saving of all images can typically be a command for a given state/reference.

SaveImage;path=c:\images\log

Example 3: Save image 2 with default filename

SaveImage;imageNo=2

Example 4: Autosave images with comment

SaveImage;comment='OK'

[0001_OK_0.bmp,0001_OK_1.bmp..0001_OK_n-1.bmp], [0002_OK_0.bmp,0002_OK_1.bmp..0002_OK_n-1.bmp]-->

or

SaveImage;comment=%sSystem.Result

Example 5: From Python using ExecuteCmd

ExecuteCmd('SaveImage',r'imageno=1;filename=c:\binar\configureshot5.bmp')
r - the r before a string avoid the filename to be converted - it means raw in python

Example 6: Autosave all images from last 1000 inspections

SaveImage;maxcount=1000  # avoids the user management of images

Example 7: Save Image including Graphics to file

SaveImage;imageNo=2;Graphics=1

Example 8: AutoSave using Central method - saving selected images

def SaveImage(path,mask):
  print 'SaveImage'
  ExecuteCmd('SaveImage','mask=%s;compression=25;type=jpg;path=%s' % (mask,path))
  print 'SaveImage done'

SaveImage('c:\\test','2') # save only image 2

 

 


Scorpion Vision Version XII : Build 727 - Date: 20181019
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2018 Tordivel AS.