How to Check if a File is a type of image?

Hi,

Considering that there are so many types of images formats out there, i want to know, other than checking its extension against a list of existing file types, is there a function to detect if a file is a type of image or not.

Thank you very much.

1 Like

Hi @Penganimation,

if you know what is the image file type (jpg. png…) then you can use this to select all files in directory of that type:
System.IO.Directory.GetFiles(“C:\Users\XXX\desktop\images”,“*.png”)

You need to assign result of this method into Array of strings or List of Strings so it should look like this:

This is how to set up it into workflow:
image

You can check for more details here:

Cheers,
Dino

Ok thank you. It seems that there is no function that works like “isImage(fileToCheck)” that returns a Boolean value. Anyways, thank you for the info:)

1 Like

Hi @Penganimation,

you have this solution here, but it is more complex there is also VB.NET available there:

Cheers,
Dino