LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Save panel as high resolution jpeg

I am trying to save a panel as a high resolution JPEG image. This is because we want to zoom in on the pictures. I have tried "SavePanelDisplayToFile" and "SaveBitmapToJPEGFile" but the picture gets blurry when zooming in. Any ideas?

0 Kudos
Message 1 of 3
(976 Views)

Hello,

unless your panel contains pictures, you'd want to save as PNG: it compresses better on uniform areas and looks better (no compression artifacts).

This being said, either format can't find more pixels than there originally were inside your panel. Does it contain a graph that you'd want to see better ?

 

One alternative could be to go full screen with the panel, SetCtrlAttribute(..., ATTR_WIDTH) and HEIGHT of your graph to the full size, save it, then reinstate the original size.

 

Once on a project we needed very detailed printouts, so what I did was create 2 panels at the same time: a visible one with a plot that was convenient to interact with and a hidden one where everything was drawn in a predetermined way (very large size, precise position, etc...). When the user pressed Ctrl-P, I'd just print the latter.

0 Kudos
Message 2 of 3
(938 Views)

Basically what gdargaud said. Both jpg and png are always pixel based image formats and there is no way you can invent extra pixels after the fact to get a better resolution when zooming. Those pixels in the image file get copied from the screen buffer the moment you safe the image to disk.

 

Windows GDI supports another capture method where the screen is captured as Enhanced Metafile (EMF) which stores the actual GDI commands to draw the screen as a vector format. This still doesn’t let you zoom into a graph like what you can do in the LabWindows CVI frontpanel (there are not really more data points in the graph so whatever method CVI uses to calculate what graph points to draw at a specific resolution is what you get even in an EMF, your graph may contain 100000 datapoints but the graph area on screen has at most maybe 2000 pixels in which those 100000 datapoints need to be squeezed).

So even with EMF you won’t really get more resolution when zooming in, it just would not get as blurry! And the standard CVI functions do not support saving to EMF. This is an archaic feature from Windows 3.0/3.1 times and while it still sits in Windows, there are very few tools which support it. Some screen capture tools can do it, The Windows clipboard supports it too when you do a screen capture through the keyboard keys but only a few tools can read and use the EMF resource in the clipboard. Almost all image processing software will instead retrieve the bitmap format and process that as a pixel map like what you get in a BMP, JPG or PNG file.

 

If you need real zoom capability, the only workable solution is to save the actual numerical data and load that in your favorite data visualization program later on. Trying to use the screen image never will work as the data needs to be decimated in order to draw it on the screen with its limited number of pixels.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(918 Views)