This study is unique in this field. It represents a mix of three branches of technology: photometry, spectroscopy, and image processing. The work treats the image by treating each pixel in the image based on its color, where the color means a specific wavelength on the RGB line; therefore, any image will have many wavelengths from all its pixels. The results of the study are specific and identify the elements on the nucleus’s surface of a comet, not only the details but also their mapping on the nucleus. The work considered 12 elements in two comets (Temple 1 and 67P/Churyumoy-Gerasimenko). The elements have strong emission lines in the visible range, which were recognized by our MATLAB program in the treatment of the image. The percentage of the elements was determined relative to iron, where in comet Temple 1, the most significant percentage of the element ratio potassium to iron is K / Fe ~ 28.2%, while the lowest value is Ca / Fe ~ 1.3%. For the comet, 67P/Churyumov-Gerasimenko, the most significant percentage of the elements relative to iron is also for potassium, K / Fe ~ 89.5%, while the lowest value is Ni / Fe ~ 0.26. In general, comparing both comets, the greatest percentage of the elements relative to iron is K / F. Iron is the base element in the structure of both comets, followed by potassium.