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) | |
print(inst.query('*IDN?').strip()) | |
bmp_bin = inst.query_binary_values(':DISP:DATA?', datatype='B', container=bytes) | |
img = Image.open(io.BytesIO(bmp_bin)) | |
img.save(args.output, args.output.split('.')[-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Requirement
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::192.168.1.21::INSTR and saves them to test.png. Output image format must be what Pillow library supports.
$ python python load_screen.py -a TCPIP::192.168.1.21::INSTR -o test.png