LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Just want to resize a .jpg image...

Hi,
I'm lost with that...
I save the graph picture in a jpg file, but the picture size is to big to be properly include in a HTML report. When I print my report, the graph is out of the sheet. I just want to know how to resize this jpg to fit it to my html sheet.
Thanks a lot.
0 Kudos
Message 1 of 5
(5,696 Views)
The first solution I'm thinking of is to go inside the html file and modify the area of the picture and that's all (it will be something like this so, just change the values programmatically).
Also, you can modify size of the jpg source in case that it's a front panel capture or something similar.
Another way is to use a program to resize the picture (you can find on the Internet a lot of old ms-dos converters) and to access it via Shell Exec VI.
The most complicated way is to play with graphical image data (bits and colors).
0 Kudos
Message 2 of 5
(5,696 Views)
That is the simplest way to go. Instead of using "Append Image to Report.vi" (which basically inserts in the HTML file) use "Append User Formatted HTML to Report.vi" to insert the image with an explicit size e.g. . Browsers make a good job to resize pictures, especially on printers.

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 5
(5,696 Views)
Thanks a lot, it works fine !
I tried to manipulate the pixmap & picture size and I lost myself. "Append User Formatted HTML to Report.vi" is a very good solution.
0 Kudos
Message 5 of 5
(5,696 Views)
In case you DO want to change the image itself: Some forms of scaling are not so difficult.
Labview supplies the VI's to convert the image from a flattened pixmap to a 2D array and back.
Such a 2D array is relatively easy to modify. It's just 1 byte per pixel.

Simplest way is just to build a new array, where you use every second pixel. In that way you scale height and width by a factor of 2. Ofcourse, taking every third pixel scales by a factor of 3, etc etc.
I attached a VI that does just that.
Message 3 of 5
(5,696 Views)