The question should be turned around the other way. These act like waves and the energy of a photon is precisely related to its wavelength. Electrons only exist at certain energy states and a pho-ton which makes contact with a particle may excite an electron or molecule to a higher energy state. This can only occur if the energy of the photon is exactly the same as the energy required to raise the electron from one energy state to another. If this occurs, photons of this particular wavelength are absorbed and the matter is opaque to the light radiation.
Some substances are translucent.
Such substances behave as they do because waves can interact with objects which have a similar size to their wavelength. This is known as interference. Crystals are good examples of translucent substances because they are regular arrays of atoms, and the distances between their atoms can be similar to the wavelengths of the photons. A material is transparent if it transmits photons which continue in their original direction, or are all deflected by the same change in direction. Such transmitted radiation retains any image which it had when it entered the material.