How to read list of images from a folder


#1

How to read list of images from a folder?


#2

@harsha1123

First Read all the image paths into a list, Let’s call it as List A, List A is List Of Strings.

Then Create a List of Images List B, List<System.Drawing.Image>

  1. Then Run foreach for List A
  2. Inside for each use Load Image Activity.
  3. Let us take each value as item in List A.
  4. Then Pass item in the field of path of Load Image Activity.
  5. Then create a image type variable imgC
  6. pass imgC in output Field.
  7. Now use Add to collections Activity and Add imgC to ListB

Now the List B will Contain Images

I have not tested this, But I think it will work.

Regards,
Mahesh


#3

Im getting errors while trying the same. Can you please share the xaml file?


#4

Hi,

Path-> string you folder location

string[] filePaths = Directory.GetFiles(path,"*.jpg")


#5

@shreyaank

What errors you are getting


#6

Hi, can you share XAML file.


#7

Hi,
Try this XAML file. Hope it works.:neutral_face:
Read images from folder.xaml (6.7 KB)


#8

Ok, I will try it!


#9

Any idea on getting String[], I am getting error…value of 1-d array of string cannot be converted to string


#10

Hi @shreyaank,

String[]-> strarray

Strarray(0).ToString()


#11

Use (.ToString). It’ll solve your problem.