I don't think this is right. The energy of a photon is h multiplied by the frequency, but the frequency itself can be anything. Even if the process creating the photon is inherently quantized (e.g. bound electron with quantized energy levels), we will measure slightly different frequencies (and so different energies), due for example to the Doppler effect[1]. Still with the Doppler effect, you can give a photon an arbitrary frequency (energy) by changing the velocity of the reference frame where you make the measurement (that is, until someone shows that the velocity of the reference frame is quantized... not something that is presently known).