LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read multi-image tiff

Solved!
Go to solution

@john1626 wrote:

Thanks. What does the image index do? Your code can read the number of images, I'll try to understand that part maybe I can do something about it so that I can view the other images.


It does read the number of images in a file.  But yes the image index selects one image from the file and displays it.  The tif you posted had two images both that looks like static but one was darker than the other.  Run my demo VI, select the tif file in for the image control, then change the image index from 0 to 1 to display one or the other.  Ico files have the same functionality.  If you want to have an array of images, I suggest making a for loop that runs for the number of images in the file getting them one at a time.

0 Kudos
Message 11 of 29
(1,770 Views)

Hi Hooovahh,

 

your ZIP contains VIs stored with LV2013 and LV2015, mixed…

 

Could you convert all of them to just one LabVIEW-Version (LV2013 preferred)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 29
(1,766 Views)
0 Kudos
Message 13 of 29
(1,758 Views)

Thank you so much. Can you also save it in LV2016?

0 Kudos
Message 14 of 29
(1,741 Views)

Is your VI limited only for 2 images (0 and 1 image index)?

0 Kudos
Message 15 of 29
(1,736 Views)

No it's not. It reads the number of pages contained in an image file so if you TIFF file has 5 images, it will adapt. But you should not pay attention to that, it is a minor detail.

 

One feedback to Hoovah though: most TIFF files I've seen have a .tiff (and not .tif) extension, that should be modified in the Load Image VI, otherwise the default case is executed (with just 1 image to be read).

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 16 of 29
(1,740 Views)

When I load a tif file with 820 image is says out of memory, what should I do?

Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception: System.OutOfMemoryException: Out of memory.

0 Kudos
Message 17 of 29
(1,737 Views)

2016 can open 2013 or 2015 code as you probably already noticed.

 

@Eric Thanks for the suggestion but I actually thought of a better improvement.  In the Load Image.vi instead of having a case that loads the file one way if it is ICO, one way if it is TIF and one for all others, you can actually delete the current Default case, and make the TIF case the Default.  It will load all other images (like PNG, JPG, BMP) get the number of images in that file (which for those file types is always 1) and then load that one image.  For file types that have multiple images the selection works as it should.  Then there is only one special case and that is for ICO files which for some reason the .Net code doesn't like the selection of images.

 

@John post your image so we can test it.  I suspect it is a corrupt image, or incomplete somehow.

Message 18 of 29
(1,730 Views)

@Hooovahh Thank you so much for helping me. I can't attach the image here because it is too big. But I still get the same error.

0 Kudos
Message 19 of 29
(1,709 Views)

Post it somewhere else and link to it.  That being said I'm not sure I could do much other than confirm your issue.  Have you tried resaving it as a new TIF maybe by using an image editor like Gimp?

0 Kudos
Message 20 of 29
(1,704 Views)