LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Importing and Editing an Image

Hello All,

 

 

I am working on a project where I need to import an image into LabView and edit it. The gist of my program is that I want to create a VI that generates an interactive floorplan.

 

I want to be able to import the bitmap or png into my file so I can edit the file by assigning flashing colors to each room, etc.

 

I tried to import the .png by wiring "Read png" --> "Draw Flattened Pixmap" --> "new picture".

 

When I run the program I get a "general I/O" error in the "Read PNG" block even though it lets me select which png I can import.

 

Does LabVIEW 8.5 not allow for importing PNG files? Does anyone have any idea why I am getting this error?

 

 

 

 

 

On another note, I was reading about some of the IMAQ VI's and they seem like they may work for importing an image and creating graphics, etc. Should I try to delve a little deeper into the IMAQ stuff?

 

 

Thanks much for the help!

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 10
(3,560 Views)

Post some sample code to help us help YOU.

 

Try another good png file to make sure there is not a problem with the file you tried.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 10
(3,558 Views)

this code helped me once when I was learning how to use picture controls hope this helps:

 

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 3 of 10
(3,547 Views)

Great call on checking whether it was just a bad file.

 

I tried to convert it from a .bmp to a .png by simply renaming it which LabVIEW did not like...

 

So I just opened it up and re-saved it with photo editing software and it worked!

 

Now I just have to play around with my editing options to get the graphics I want. 

 

 

 

I'll post some sample code just for suggestions that anyone may have. This is just my preliminary structure without most of my condition statements. All the code inside the case structures will be added when I figure all this stuff out.

 

My goal is to have each strobe and interlock correspond to a different graphic on the floorplan. For example, when strobe 1 reads red, I want the corresponding room to flash red and vice versa with green and yellow. Also, when interlock 1 reads false, I want a flashing light to pop up next to the corresponding door.  

 

Anyone have any ideas for how to make these kinds of graphics? I figured I may be able to use a color box for the solid colors and LEDs for the flashing lights but I would rather edit the pixels to make it look more professional.

 

 

Thanks for all the help!

0 Kudos
Message 4 of 10
(3,538 Views)

This thread has a lot of picture related links that we have been collecting over the years. In that collection you will find a link to this thread where andrey post some code you find useful. Does this look useful?

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 10
(3,526 Views)

That looks very useful. I will definitely check it out and see what I come up with.

 

 

 

Thanks again!

0 Kudos
Message 6 of 10
(3,522 Views)

CINC.Cal wrote: 

I tried to convert it from a .bmp to a .png by simply renaming it which LabVIEW did not like...


That will never work, and it wouldn't be limited to just LabVIEW not liking it. Renaming a file doesn't magically change its format. You need to resave it under the new format. 

 

Tip: If you're running on Windows, the regular Windows Paint program can do this, so you don't have to resort to full-blown photo editing software.

0 Kudos
Message 7 of 10
(3,517 Views)

It has worked for me in the past when I renamed unzipped file extensions to match the demands of an install program.

 

But that is beside the point and something i should have realized when opening with a specific program. I'm glad all it took was for me to re-save it in order to get it to work 🙂

 

 

 

Also, the thread that Ben linked and the the program that Harold attached both seem to be very helpful. Unfortunately, LabVIEW 8.5 won't open the Alarm Display vi. Is there any way around this? My boss has 8.6 but he is gone for the week 😞

Message Edited by CINC.Cal on 08-03-2009 12:40 PM
0 Kudos
Message 8 of 10
(3,513 Views)
here it is in 8.5
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 9 of 10
(3,486 Views)

CINC.Cal wrote:

It has worked for me in the past when I renamed unzipped file extensions to match the demands of an install program.

 

But that is beside the point and something i should have realized when opening with a specific program. I'm glad all it took was for me to re-save it in order to get it to work 🙂


That's actually a different situation. The OS has no mechanism to change a file's type based on just changing the name, including the extension. The file type is based on the contents of the file, not its name. The extension is a convenient mechanism for the OS to be able to map an application to use to open the file. Historical note: Back in the old days the Mac OS (before it becames OS X) used a 4-character type code and 4 character app code for a file to indicate which application to use to open the file, and what kind of file it was (should the application use different file types). Thus, the name itself was actually irrelevant. Good idea, but impractical for implementation since it required you to register your codes with Apple before you could release your app. Can't imagine trying to do that today with Microsoft! 

0 Kudos
Message 10 of 10
(3,467 Views)