10-05-2022 05:49 AM
Please help to get/save a screen capture image file to PC from oscilloscope by Labview.
I could save a file to pc but it can not open. I think my program needs a function colored red? but I don't know the way in labview.
Keysight manual for python
# --------------------------------------------------------
# Download the screen image.
screen_bytes = do_query_ieee_block(":DISPlay:DATA? PNG")
# Save display data values to file.
f = open("screen_image.png", "wb")
f.write(screen_bytes)
f.close()
# --------------------------------------------------------
Solved! Go to Solution.
10-05-2022 07:09 AM
Hi Nimy,
@Nimy2022 wrote:
I could save a file to pc but it can not open. I think my program needs a function colored red? but I don't know the way in labview.
screen_bytes = do_query_ieee_block(":DISPlay:DATA? PNG")
In the end you just use VISARead - and apply all the information given in the programmer manual for your scope!
Most often you receive a length indicator (number of bytes) and then you can read that number of bytes using another VISARead.
Then you save the bytes, but without their prepended length indicator!
In your image you request a fixed number of bytes, which is rather uncommon for PNG files. It also is not clear if you handle TermChars correctly…
10-05-2022 07:23 AM - edited 10-05-2022 07:25 AM
Exactly which oscilloscope are you using here?
Judging from the function name (do_query_ieee_block), the data is being transferred using a "data block" protocol. The reply would start with a # followed by a number character that states the number of characters in the length, followed by that number of characters which tells you the number of bytes in the data block, and finally the block of raw data.
Here is my code for reading a data block. The "Query" is just a VISA Write followed by a VISA Read.
And here are the contents of the Read Binary:
10-05-2022 09:00 AM - edited 10-05-2022 09:01 AM
What model oscilloscope? Have you searched for any LabVIEW "Drivers"?
Most modern scopes' Labview driver sets have a VI for retrieving waveforms either as a screen copy (Image) or x/y numeric values.
10-05-2022 10:20 AM
If you already grabbed the trace as data, you could plot the data on a graph and take grab the graph as a picture. (There are Vis that can take a snapshot of a control and make a picture out of it.)
10-11-2022 03:35 AM
Hi all,
Thanks for reply.
I have tried to ideas you gived but I could not make it work well.
It seems the png file has collect hex about header and footer now.
What should I add more?
Best regards.
10-11-2022 04:25 AM
My OSC is DSO-X 2004A. I didn't find the vi for screen shot.
10-11-2022 05:07 AM
10-11-2022 06:09 AM
Hi GerdW,
>why do you convert raw data (U8 array) to string?
That' to delete CRLF...but now it's unnecessary.
>why do you delete "0D0A" from your raw data?
That was adjustment for problem which was added unintentional some hexes by binary editor I used, sorry.
But I tried again without "delete CRLF" block, but still not work well.
10-11-2022 11:31 PM
I was able to save a png file to my pc, and here's how to do it.
Thanks for advices.
I have additional questions,
- how can I count the picture size in reading?
- "What's this?" block
Best regards,
Nimy