vncdotool icon indicating copy to clipboard operation
vncdotool copied to clipboard

always got black picture

Open yunpengb opened this issue 8 years ago • 11 comments

Hi, I use python script and try to capture a picture of one host the host is installed tightvnc and it's win7 system. my code is like this:

from vncdotool import api
client = api.connect('192.168.1.199', 'passwd')
client.captureScreen('pic.png')

it always leave a black screenshot, what's wrong with my code?

yunpengb avatar Feb 23 '17 08:02 yunpengb

Facing exactly the same problem using the cl-tool running: vncdo -s 127.0.0.1 capture screen5.png Using Win10 and have installed TightVNCServer

julianweise avatar Mar 01 '17 09:03 julianweise

Same here, using TightVNCserver 2.8.8 on Windows 7 Pro.

MagicFab avatar Jun 07 '17 15:06 MagicFab

Has this been resolved with recent changes?

sibson avatar Jan 26 '18 04:01 sibson

okay i tried with both command line invocation and api-call via python

i also got black screen when using tightvnc 2.8.11 on windows 10 (1511)

but i used following code to get screenshot, which worked without problems:

with api.connect("1.2.3.4", password="mypass", timeout=10.0) as cli:
	cli.refreshScreen()
	cli.captureScreen("test.jpg")

also note that it works well on osx's own vnc server (10.11.6)

spacelatte avatar Oct 03 '18 13:10 spacelatte

I got black screen via vncdotool api:

from vncdotool import api
import time
class vnctest(object):
    def takescreenshot(self,in_host,in_password):
        vnc_host=in_host
        vnc_password=in_password
        vnc_session=api.connect(vnc_host,password=vnc_password)
        time.sleep(5)
        try:
            vnc_session.captureScreen('screenshot.png')
        except:
            print('Timeout when attempt to capuring screen')
        vnc_session.disconnect() 

test=vnctest()
test.takescreenshot('<my vnc server IP>','<my vnc server password>')

But if I use tightvnc-2.8.11(Clinet is WIN7, and server is WIN10), I can observe all viewer. At the same time, I run above test script. It can got normal screenshot. Once I disconnect tighvnc viewer and wait a few mins, the screenshot can't be use again.

Chenshennan avatar Dec 17 '18 06:12 Chenshennan

vncdotool -s $HOST:$PORT capture screen.png works fine for me. Maybe this 5 year old bug can be closed?

pmhahn avatar Dec 20 '22 10:12 pmhahn

I experience exactly the same issue with TightVNCServer...

mikhail-ict avatar Dec 17 '23 08:12 mikhail-ict

I experience exactly the same issue with TightVNCServer...

What does "exactly" mean: You use that 5 year old version and got a black screen?

Please(!) provide actionable data, e.g.

  • which Python version
  • on which platform
  • which version of vncdotool
  • which VNC server / which version / which screen resolution / …

Please run vncdotool -v -s $HOST:$PORT capture $FILENAME.png and post the debug output; so far you comment does not provide any value and we cannot help you and cannot fix any bug.

pmhahn avatar Jan 05 '24 13:01 pmhahn

Please(!) provide actionable data, e.g.

  • which Python version
  • on which platform
  • which version of vncdotool
  • which VNC server / which version / which screen resolution / …

Please run vncdotool -v -s $HOST:$PORT capture $FILENAME.png and post the debug output; so far you comment does not provide any value and we cannot help you and cannot fix any bug.

Python is 3.10.9 Platform is Windows 10 22H2 (screen resolution is 1920x1200) vncdotool is 1.2.0 TightVNCServer is 2.7.10

Output:

INFO:root:connecting to 192.168.1.125:5900
INFO:twisted:Starting factory <vncdotool.command.VNCDoCLIFactory object at 0x000001AD53F51D90>
INFO:twisted:Using protocol version 3.8
INFO:twisted:Offered <AuthTypes.VNC_AUTHENTICATION: 2>
INFO:twisted:Offered <AuthTypes.TIGHT: 16>
VNC password:
INFO:twisted:Native PixelFormat(bpp=32, depth=24, bigendian=False, truecolor=True, redmax=255, greenmax=255, bluemax=255, redshift=16, greenshift=8, blueshift=0) bytes=4
INFO:twisted:Offering <Encoding.RAW: 0>
INFO:twisted:Offering <Encoding.PSEUDO_DESKTOP_SIZE: -223>
INFO:twisted:Offering <Encoding.PSEUDO_LAST_RECT: -224>
INFO:twisted:Offering <Encoding.PSEUDO_QEMU_EXTENDED_KEY_EVENT: -258>
INFO:root:connected to b'instructor'
INFO:twisted:x=0 y=0 w=1920 h=1200 <Encoding.PSEUDO_DESKTOP_SIZE: -223>
INFO:twisted:Stopping factory <vncdotool.command.VNCDoCLIFactory object at 0x000001AD53F51D90>
INFO:twisted:Main loop terminated.

The file: test

mikhail-ict avatar Jan 05 '24 14:01 mikhail-ict

Thank you for the extra data, that helps very much.

INFO:twisted:x=0 y=0 w=1920 h=1200 <Encoding.PSEUDO_DESKTOP_SIZE: -223>

Just a guess: Looks like we get that out-of-band message while actually waiting for the screen content data and we exit immediately instead of waiting for the data and process it. Someone™ has to investigate this…

pmhahn avatar Jan 05 '24 22:01 pmhahn

Is there any updates on this?

mikhail-ict avatar May 08 '24 06:05 mikhail-ict

This is still an issue, and unfortunately prevents me from using this tool even though it seems like one of the best.

rex avatar Oct 08 '24 13:10 rex