LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing an image in a report

I need to print a test report in which I want to include the copy of a waveform graph and some additiona text (test settings, date of execution and of printing...).
I tried using NIReports, both normal and HTML type, but I found that the image of the graph is larger that the page size both in landscape and in portrait orientation. I am actually creating an image of the control by using the Get Image method of an Invoke node on the graph itself, saving as .PNG in order to save disk space and including it in the report using Append Image to Report.vi.
My question is: is it possible to resize an image that has to be printed on a report?
And, if possible, can it be done with a property node or some analogue manner or should I
deal with the array of flattened data that output from the Get Image node?
Any help would be appreciated.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 7
(5,739 Views)
Probably the simplest way is to properly resize the waveform graph *before*
invoking the Get Image method. For example you could make a VI with a
waveform graph on it for the sole purpose of getting its image for NIReport.
Programmatically format the graph using property nodes before getting its
image.

Jean-Pierre Drolet
Scientech R&D


"Roberto Bozzolo" a écrit dans le message news:
5065000000080000008A210000-991728092000@quiq.com...
> I need to print a test report in which I want to include the copy of a
> waveform graph and some additiona text (test settings, date of
> execution and of printing...).
> I tried using NIReports, both normal and HTML type, but I found that
> the image of the graph is larger that the page size both in landscape
> and
in portrait orientation. I am actually creating an image of the
> control by using the Get Image method of an Invoke node on the graph
> itself, saving as .PNG in order to save disk space and including it in
> the report using Append Image to Report.vi.
> My question is: is it possible to resize an image that has to be
> printed on a report?
> And, if possible, can it be done with a property node or some analogue
> manner or should I deal with the array of flattened data that output
> from the Get Image node?
> Any help would be appreciated.
> Roberto


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 7
(5,739 Views)
As usual, a complex problem has a simple solution. And the more you are involved in the problem, the lesser you see that simple solution.
Thank you
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 7
(5,739 Views)
Dear Jean-Pierre,
today I have tried your solution and found a 'little' problem: the 'bounds' properties for a graph are read-only! Seems that there is something missing to me: can you detail a little more how you would do it?
One solution could be to build a vi with a graph on it suitable for printing into which to copy test data prior to including it in the report, but I see some difficulties:
1. My program executes 8 different tests, each one with its own graph with different axis and scaling
2. I need to copy on the new graph all the customizations the customer has done on the original one (axis scaling, plot attributes...). A little boring work. And I'm sure that something will miss of the customer's work!
Is there a way to copy a graph on a n
ew vi and reshape it?
As usual, thanks for any suggestion.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 7
(5,739 Views)
"Roberto Bozzolo" a �crit dans le message news:
506500000005000000F1300000-991728092000@quiq.com...
> Dear Jean-Pierre,
> today I have tried your solution and found a 'little' problem: the
> 'bounds' properties for a graph are read-only! Seems that there is
> something missing to me: can you detail a little more how you would do
> it?

The bounds are the overall area occupied by the graph, including palettes,
legends and labels. It is read-only for all controls. However, other parts
of the graph are sizeable, like the PlotAreaSize property.

> One solution could be to build a vi with a graph on it suitable for
> printing into which to copy test data prior to including it in the
> report, but I see some difficulties:
> 1. My program executes 8 different tests, each one with its own graph
> with different axis and scaling
> 2. I need to copy on the new graph all the customizations the customer
> has done on the original one (axis scaling, plot attributes...). A
> little boring work. And I'm sure that something will miss of the
> customer's work!
> Is there a way to copy a graph on a new vi and reshape it?
> As usual, thanks for any suggestion.
> Roberto

I am not aware of any method to make an integral copy of a control to
another, both data and properties. It may be tedious to copy all properties
one by one for elaborated graph edited by the user. One thing you can try is
to resize the original graph (plot area) to get the image and restore its
size thereafter. The operation will be visible to the user unless you hide
it some way. Be aware also that the reduced image won't be exactly like the
original; the grid and scale markers will be automatically adjusted by the
resizing.

It just occurred to me that it may be also possible to programmatically edit
the HTML code produced by NIReport to resize the picture area. I will take a
look on this and reply with more info on this. This would be the best option
because browsers make a really good job to resize pictures.

Good luck.

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 7
(5,739 Views)
Yes it works...
Instead of using "Append Image to Report.vi", use "Append User Formatted
HTML to Report.vi"
Enter the following HTML tag:


If the path to your image contains spaces, replace them with "%20". Set w
and h to the width and height you want. Maybe there are other attributes in
the tag. Save the report to HTML(using "Append Image..." and have a look to
the image tag and just add the same attributes with height and width.

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 7
(5,739 Views)
Roberto,

I think that the best method is to resize the waveform graph before you convert it to a PNG file and then append it to your report. I have written an example that illustrates the procedure.

Best Regards,

Eric Enger
National Instruments
Applications Engineer
Download All
0 Kudos
Message 6 of 7
(5,739 Views)