If you know the road number (listed on the side of the cab) and the railroad, it is easy.
Find the railroad here, and then find its reporting mark: http://en.wikipedia.org/wiki/List_of_reporting_marks
Then, go to a site like http://www.rrpicturearchives.net/. If you click on the "search" link on the menu at left, there is an option to do a locomotive search. Type in the road number, and the railroad's reporting marks, and it will tell you the type of locomotive.