Planets do not make their own light. They only shine due to the light from their star hitting them and bouncing off. This light includes visible light, but also other wavelengths, like infrared.
The amount of light a planet re-emits reflect depends on the albedo of the planet. Most planets do not give off much light, especially at visible wavelengths. Compared to their parent stars, exoplanets are very faint. Using this method is a bit like looking for a lit match in the middle of a floodlit sports stadium. Fewer than 100 exoplanets have been discovered using direct imaging.
Astronomers use a circular plate called a coronagraph to block the light from the star. This reveals faint objects around the brighter star. The further an exoplanet is from its star, the easier it should be to separate light from the star and the planet. However, the greater the distance, the less light the planet receives from the star, and so it re-emits less light.
Sometimes though, it is possible to detect the heat of a distant planet. We call this its 'thermal emission'. Using our knowledge of Wien’s Law, we know that a planet like our Earth re-emits most of its light as infrared waves. However, some objects found using this method may not be exoplanets. Brown dwarfs, are also low-mass, faint and detected most easily in the infrared.
Young planets give off more heat than older planets and are easier to find using this method. The oldest exoplanet found by direct detection is Proxima Centaur c. It is thought to be about 7 times the mass of Earth and 4,800 million years old.