Skip to content

ScreenGear API Parameters⚓

monitor⚓

This parameter enables mss usage and is most suitable for selecting index of a specific screen (from where you want retrieve frames) in multi-monitor setup. For example, its value can be assign to 2, to fetch frames from a secondary monitor screen. More information can be found here ➶

You can assign monitor value to -1 to fetch frames from all connected multiple monitor screens.

Implication of using monitor parameter

Any value on monitor parameter other than None in ScreenGear API:

  • Will force mss library backend.
  • Will output BGRA colorspace frames instead of default BGR.
  • Will disable the backend parameter.

Data-Type: Integer

Default Value: Its default value is None (i.e. disabled by default).

Usage:

ScreenGear(monitor=-1) # to fetch frames from all connected multiple screens

 

backend⚓

This parameter enables pyscreenshot usage and select suitable backend for extracting frames in ScreenGear. The user have the authority of selecting suitable backend which generates best performance as well as the most compatible with their machines. The possible values are: pil, mss, scrot, maim, imagemagick, pyqt5, pyqt, pyside2, pyside, wx, pygdk3, mac_screencapture, mac_quartz, gnome_dbus, gnome-screenshot, kwin_dbus. More information on these backends can be found here ➶

Performance Benchmarking of each backend can be found here ➶

Remember to install backend library and all of its dependencies you're planning to use with ScreenGear API.

Any value on monitor parameter will disable the backend parameter. You cannot use both parameters at same time.

Data-Type: String

Default Value: Its default value is "" (i.e. default backend).

Usage:

ScreenGear(backend="mss") # to enforce `mss` as backend for extracting frames.

 

colorspace⚓

This parameter selects the colorspace of the source stream.

Data-Type: String

Default Value: Its default value is None.

Usage:

All supported colorspace values are given here ➶.

ScreenGear(colorspace="COLOR_BGR2HSV")

Its complete usage example is given here ➶

 

options⚓

This parameter provides the flexibility to manually set the dimensions of capture screen area.

Supported Dimensional Parameters

Supported Dimensional Parameters are as follows:

  • left: the x-coordinate of the upper-left corner of the region
  • top: the y-coordinate of the upper-left corner of the region
  • width: the width of the region
  • height: the height of the region

Additional Exclusive Attribute such as THREAD_TIMEOUT is also supported for this parameter.

Data-Type: Dictionary

Default Value: Its default value is {}

Usage:

The desired dimensional parameters can be passed to ScreenGear API by formatting them as attributes, as follows:

More information about screen dimensioning can be found here ➶

# formatting dimensional parameters as dictionary attributes
options = {'top': 40, 'left': 0, 'width': 100, 'height': 100}
# assigning it w.r.t monitor=1
ScreenGear(monitor=1, **options)

 

logging⚓

This parameter enables logging (if True), essential for debugging.

Data-Type: Boolean

Default Value: Its default value is False.

Usage:

ScreenGear(logging=True)

 


Last update: October 7, 2021