LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Putting images next to each other in a new image

Solved!
Go to solution
Hi,

In my program I've got two images (each 400x400 px) that I want to combine into a single picture (and save it to disk).
To do this I extract the image data and use build array to create a new image array.
Then I create a new image with dimensions 0,0 - 800,400 and use the new image array as data input.
The picture is saved to disk, but the two original images are underneath each other.
I would like to have them next to each other, but I'm not sure how to do that.
Attached is a screenshot of my original program.

Regards,

Bjorn
0 Kudos
Message 1 of 3
(3,127 Views)

You have found the easy way one over the other but the side by side takes more work. I can't code up an example but I can outline the work (subject to my memory).

 

THe image data is just a 1-d aray that has all of your pixel data is raster scan format starting at teh top left working to the righ and then down. THat is why you can easily add one image above the other.

 

To get thhem side by side you are going to have to interlace teh scan lines from each image so teh 1-d array contains

 

Pic1_Scan1, Pic2_Scan1, Pic1_Scan2,...

 

THe size of each scan line can be derived from the image size.

 

Watch for padding since images are padded out to multiples of 8 (if memory serves).

 

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 3
(3,119 Views)
Solution
Accepted by topic author BjornStevens

There are a couple of ways to let the picture functions do the work for you.  The most efficient is to change the rectangle of the second image, but the code to change this to that and add this to that is a bit ugly, so I take the easy way out this time, but suggest you write a little subVI to simply shift the rectangle.  Then you can choose side by side, on top, add padding, etc.

 

Here is the easy (to code) way out.

 

SideBySide.png

0 Kudos
Message 3 of 3
(3,092 Views)