This research introduces an approach to visible spectroscopy leveraging image processing techniques and machine learning (ML) algorithms. The methodology involves calculating the hue value of an image and deriving the corresponding dominant wavelength. Initially, a six-degree polynomial regression supervised machine learning model is trained to establish a relationship between the hue values and dominant wavelengths. Subsequently, the ML model is employed to analyse the visible wavelengths emitted by various sources, including sodium vapour, neon lamps, mercury vapour, copper vapour lasers, and helium vapour. The performance of the proposed method is evaluated through error analysis, revealing remarkably low error percentages of 0.04%, 0.01%, 3.7%, 1%, and 0.07% for sodium vapour, neon lamp, copper vapour laser, and helium vapour, respectively. This approach offers a promising avenue for accurate and efficient visible spectroscopy, with potential applications in diverse fields such as material science, environmental monitoring, and biomedical research. This research presents a visible spectroscopy method harnessing image processing and machine learning algorithms. By calculating hue values and identifying dominant wavelengths, the approach demonstrates consistently low error rates across diverse light sources.