If I understand it correctly, TImage.LoadFromFile determines the type of picture from the file extension.
TImage.LoadFromFile
Is there any way to detect the image type auto
starting from here you can easily do it: http://delphihaven.wordpress.com/2011/01/22/tip-detecting-graphic-formats/