We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Detect image format

I have multiple image files I am loading that do not have the extension, and can be either tif or jpg format. Is there anyway using the Imaging product to detect the image format? Thank you.

Hi Tina,


Thank you for considering Aspose products, and welcome to Aspose.Imaging support forum.

Please use the factory method Image.GetFileFormat to detect the image format regardless of the file extension. Below provided code snippet demonstrates the usage for better elaboration.

C#

Console.WriteLine(Image.GetFileFormat(myDir + “duck”));

Please feel free to write back in case you have more questions for us.

Awesome, Thanks!