Mike Le Posted August 1, 2014 Report Share Posted August 1, 2014 I have a front panel with a few overlapping subpanels. The subpanels are transparent and sitting on top of a graph, with data plotted. One of them is my custom Legend control, which displays all the plotted signals. I'd like to take a screenshot of it and output to picture. I tried using the built-in "Get Image" invoke nodes. I found that even though the subpanels are transparent, when output as a picture, they return as opaque - thus obscuring parts of the graph. I need to take a picture of the panel exactly as it is, including the signals listed on the Legend, etc. but while preserving transparency. Does anyone know a good way to do this? Thanks. Quote Link to comment
mje Posted August 1, 2014 Report Share Posted August 1, 2014 I'm curious about this as well because I've not managed to get transparency working that we'll either. I expect that there's no way to get what you want natively. I don't think the picture API understands transparency and I believe the get image functionality uses this API. Quote Link to comment
Mike Le Posted August 4, 2014 Author Report Share Posted August 4, 2014 That's frustrating but not terribly surprising. I may have to use the Windows API to call "print screen" and then crop it to the right area, which I'm worried could lead to little bugs or problems. Quote Link to comment
Jordan Kuehn Posted August 4, 2014 Report Share Posted August 4, 2014 For casual screenshots I use an open source tool called ShareX (formerly ZScreen). It has command line arguments and hotkeys that would allow you to automatically take a screenshot of a particular window (you can play with this manually to see if you like it) and store it or send it to a variety of places. Something like this might meet your needs and should be fairly lightweight. https://github.com/ShareX https://github.com/ShareX/ShareX/wiki/Command-line-arguments http://en.wikipedia.org/wiki/ShareX (not sure why this exists, but it seems to have good info) Quote Link to comment
Mike Le Posted August 5, 2014 Author Report Share Posted August 5, 2014 Jordan, what's the advantage of ShareX versus using LabVIEW's built-in Windows API? It seems much simpler just to drop a call to the Windows DLL for keyboard commands and use "printscreen" rather than build something in LabVIEW to talk to ShareX? Maybe I'm confused about what you're suggesting. Quote Link to comment
Jordan Kuehn Posted August 5, 2014 Report Share Posted August 5, 2014 Jordan, what's the advantage of ShareX versus using LabVIEW's built-in Windows API? It seems much simpler just to drop a call to the Windows DLL for keyboard commands and use "printscreen" rather than build something in LabVIEW to talk to ShareX? Maybe I'm confused about what you're suggesting. The primary advantage would be to specify which window you want captured rather than trying to dynamically crop based upon the current size and location of the FP within the screen. This tool does not account for if the window is not entirely within the screen, but neither would a generic printscreen. Quote Link to comment
PiDi Posted August 5, 2014 Report Share Posted August 5, 2014 Alt + Print Screen captures only current active window, not the entire screen. You'd only need to make your app window active before this, but this can also be achieved through API calls. Quote Link to comment
Jordan Kuehn Posted August 5, 2014 Report Share Posted August 5, 2014 Nice. I didn't know that. Quote Link to comment
bmoyer Posted August 5, 2014 Report Share Posted August 5, 2014 Once you get this working I'm interested in the code for this. I implemented Alt-Printscreen using simulated keystrokes using the user32.dll keybd_event and it worked in the LV environment, but was not reliable when running it in an exe. I had to go with a .NET method of getting an image of the screen and then cropping the image using the window location. Quote Link to comment
Mike Le Posted August 5, 2014 Author Report Share Posted August 5, 2014 The primary advantage would be to specify which window you want captured rather than trying to dynamically crop based upon the current size and location of the FP within the screen. This tool does not account for if the window is not entirely within the screen, but neither would a generic printscreen. Well, regardless I'll have to crop it down to the Graph control and the embedded subpanels. Once you get this working I'm interested in the code for this. I implemented Alt-Printscreen using simulated keystrokes using the user32.dll keybd_event and it worked in the LV environment, but was not reliable when running it in an exe. I had to go with a .NET method of getting an image of the screen and then cropping the image using the window location. That's discouraging, I was planning on using user32.dll. We'll see how that goes. Quote Link to comment
bmoyer Posted August 6, 2014 Report Share Posted August 6, 2014 That's discouraging, I was planning on using user32.dll. We'll see how that goes. Here's the VIs I was using. Hopefully it is helpful. The idea was to get the screenshot of the top most window or VI and to save it to a file. Here's the .NET solution to take an screenshot of a VI. You'll find that there are other VIs on Lava G that are similar, I just formatted the .NET calls to suit my individual needs (it also uses an OpenG VI). Simulate keyboard.vi Save Active Window Image to File.vi Screenshot with Options (.NET).vi File Dialog with Overwrite Rename Cancel if exists.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.