LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Load Image Data Directly Into a PictureBox

Solved!
Go to solution

Hello all,

 

I'm working on a help window, and I want to be able to store the help contents as image data (flattened to string) in a database. I want to then unflatten and convert it back to image data and load it into a PictureBox. Is there a way I can do that without saving the image to file? Currently, the only way I see to load an image to a PictureBox is by loading a saved image.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 1 of 11
(6,474 Views)

It's not clear exactly what you want.  Maybe this will work for you:

Run this code:

pb1.png   Then right-click on the "image data" terminal and select: Create -> Constant.

 

Use that constant in this code:

pb2.png

 

And to retrieve the image from the DB

pb3.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 11
(6,436 Views)

Thought I explained it pretty well but I'll try again. What I want is for 'image data' to be loaded into a .NET PictureBox control directly instead of needing a saved image file. See the attached screenshot. Ignore all the math, it's to make the window look nice no matter what size the image is.

Spoiler
FireFist-Redhawk_0-1624016749707.png
Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 3 of 11
(6,411 Views)

Why not just use a LabVIEW picture indicator?

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 11
(6,396 Views)

I guess it's mostly that gray bevel on the outside of it that I don't like, but I might end up doing that.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 11
(6,391 Views)

If you use the classic version of the Picture control, you can color the border transparent.

"If you weren't supposed to push it, it wouldn't be a button."
Message 6 of 11
(6,386 Views)

To me the classic and regular version are both basically the same thing. Do you color it with property nodes or?

 

EDIT: figured out it's colored by using the paint tool in edit mode, just gotta get the cursor right on the 3 pixels of the border. Thanks!

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 7 of 11
(6,380 Views)

@FireFist-Redhawk wrote:

To me the classic and regular version are both basically the same thing. Do you color it with property nodes or?

 

EDIT: figured out it's colored by using the paint tool in edit mode, just gotta get the cursor right on the 3 pixels of the border. Thanks!


Note: Those bezels on the classic controls can only be colored with the coloring tool.  There is no property available to access the color of a bezel.

"If you weren't supposed to push it, it wouldn't be a button."
Message 8 of 11
(6,373 Views)
Solution
Accepted by topic author FireFist-Redhawk

I posted some code here that demonstrates a few things with the picture box.

 

https://forums.ni.com/t5/LabVIEW/Read-multi-image-tiff/m-p/3580103#M1002365

 

Here it loads an image, preserving the alpha layer information if there is any, it can select an image to display if a file contains multiple images, and does automatic scaling to the pane without additional code.  I used a similar set of code to allow for rotating of an image using .Net.

 

https://forums.ni.com/t5/LabVIEW/How-to-rotate-objects-or-pictures-on-my-FP/m-p/3200578#M927937

 

Message 9 of 11
(6,293 Views)

The attached may be of use with some modifications for PNG instead of JPEG. It uses .Net.

Message 10 of 11
(6,174 Views)