Hyperspectral imaging was successfully used to measure spinach pigments content. Optimal wavelengths selected by a new random frog algorithm were proved efficient. Visualization of pigments distribution of spinach leaf were analyzed. The method had the potential to track changes of quality of vegetables for real-world application.