An iterative algorithm which identifies the presence of different gases using a hyperspectral image was developed and tested. The algorithm uses the "stepwise regression" method combined with new methods of detection and identification. This algorithm begins with a library of gas signatures; an initial fit is done with all the gases. The algorithm then eliminates those signatures which do not noticeably improve the fit to the measured signature. We then consider which of the gases that were detected have a high probability of being mistaken with the detection of other gases that are also present in the scene. A necessary post-processing step eliminates gases which do not uniquely fit the signature of the examined pixel, with an emphasis on eliminating gases which may have been misidentified.