sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #54176
[Bug 1863949] Re: [2.0.2] VNC: capture() returns ScreenImage instead of filename
found related, 315005, thanks to getFile command. I suppose you can close, please document this.
https://sikulix-2014.readthedocs.io/en/latest/screen.html#Screen.capture
>From documentation:
Capturing is the feature, to grab a rectangle of pixels from a screenshot and save it to a file for later use. Each time, a capturing is done, a new screenshot is taken (Screen.capture()).
.....
…on Java usage or in non-Python
String filename = screen.saveCapture(Object... args)
String filename = region.saveCapture(Object... args)
… where screen/region are some existing Screen/Region objects.
The args are according to the above parameter specifications of the two
Screen.capture() variants.
screen.saveCapture() is a shortcut for String filename =
screen.cmdCapture(Object... args).getStoredAt()
The intermediate result of cmdCapture is a ScreenImage object, that
holds the image internally as BufferedImage (accessible using
ScreenImage.get()).
CODE:
imagePath = Screen(0).capture().getFile()
print imagePath
imagePath = Screen(1).capture().getStoredAt()
print imagePath
imagePath = Screen(2).capture().get()
print imagePath
OUTPUT:
/tmp/Sikulix_1729683/sikuliximage-1582206170280.png
None
[error] AttributeError ( 'org.sikuli.script.ScreenImage' object has no attribute 'get' )
[error] --- Traceback --- error source first
line: module ( function ) statement
61: main ( <module> ) imagePath = Screen(2).capture().get()
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1863949
Title:
[2.0.2] VNC: capture() returns ScreenImage instead of filename
Status in Sikuli:
In Progress
Bug description:
In 2.0.2, on 64 bit Arch Linux, depending on how capture is called it
is no longer returning a file path. I cannot find anywhere where this
behavior is documented and therefore am reporting it as a bug. It
seems to be returning a java object and making a java call.
imagePath = SCREEN.capture()
print imagePath
imagePath = VNC.capture()
print imagePath
imagePath = capture(VNC) #FYI - local screen captured
print imagePath
exit(0)
Actual:
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
org.sikuli.script.ScreenImage@59ab5f32
org.sikuli.script.ScreenImage@4236bae8
[info] Exit code: 0
/tmp/Sikulix_1686686143/sikuliximage-1582144646621.png
Expected:
shutil.move(vnc.capture(), FULL_PATH) #from tmp
Work around:
img = vnc.capture().saveInBundle("temp")
shutil.move(img, FULL_PATH) #from bundle
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1863949/+subscriptions
References