Up | Draw | Overlay | Tool | Toollist | Timer | SPB | Camera | CameraImage | Bitmap | Historylist - ImageBuffer | Clipboard | ScorpionGeometry | Statistics | Curve | States | Logging | Panels | Shared Memory | BarCode Reader | StdCtrls

Release Notes
 

  

 
Bitmap
The Bitmap module contains classes and methods for working with images.
The Bitmap class

Use the function GetBitmap(name) to get a read only instance of the class. It is not possible to change any of the attributes of an image retrieved by name.

Use the function GetBitmap() to get a writeable instance of the class, or use the clone() method of an instance to get a writeable instance.

Attribute Access Type Description
width R [/W] int width of image in pixels
height R [/W] int height of image in pixels
handle R [/W] int The windows HBITMAP handle. Valid in the Scorpion process only.
pixelFormat R [/W] int
  • 0=Device
  • 1=1bit
  • 2=4bit
  • 3=8bit
  • 4=15bit
  • 5=16bit
  • 6=24bit
  • 7=32bit
  • 8=Custom
matr R [/W]   the image matrix, same format as GetImageMatr/SetImageMatr

 

Method Returns Description
load(filename) bool loads image from given filename (bmp/jpg). Only possoible for writeable instances.
save(filename) bool save image to given filename (bmp/jpg)
clone() Bitmap creates a copy of the bitmap. The cloned bitmap may be modified

Example 1: Convert an image from color to greyscale

bmp=GetBitmap('Image').clone()	#get a copy of the origin bitmap
bmp.pixelFormat = 3		#force greyscale
SetImageMatr('Image',bmp.matr)	#writeback the modified image

Example 2: Create a new bitmap

import myImageLib
bmp=GetBitmap()
bmp.pixelFormat = 3		#set greyscale
bmp.height = 480			#set dimensions
bmp.width = 640
myImageLib.foo( bmp.handle ) 	#modify the image in some 3'rd party library using the bitmap's HBITMAP
SetImageMatr('Image',bmp.matr)	#write back the modified image
 

Scorpion Vision Version XII : Build 665 - Date: 20170919
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.