Skip to content

Instantly share code, notes, and snippets.



Last active Jun 18, 2020
What would you like to do?
Save screen image of RIGOL MSO5000 series oscilloscope
import visa
import argparse
from PIL import Image
import io
argparser = argparse.ArgumentParser()
argparser.add_argument('-a', '--address', required=True, help='VISA address like "TCPIP::{ipaddress}::INSTR"')
argparser.add_argument('-o', '--output', help='Output file name (default: "screen.png")', default='screen.png')
args = argparser.parse_args()
inst = visa.ResourceManager().open_resource(args.address)
bmp_bin = inst.query_binary_values(':DISP:DATA?', datatype='B', container=bytes)
img =, args.output.split('.')[-1])

This comment has been minimized.

Copy link
Owner Author

@idt12312 idt12312 commented Jun 9, 2020


If you already have some visa backend software (NI-VISA etc.), PyVISA-py isn't needed.

How to use

The following command means that the script loads a screen image from the oscilloscope whose visa address is TCPIP:: and saves them to test.png. Output image format must be what Pillow library supports.
$ python python -a TCPIP:: -o test.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment