Smaller stars, however, will turn into dense white dwarfs and the layers they shed will form nebulas like the one in the Hubble picture.
NASA said: “A white dwarf is what stars like the Sun become after they have exhausted their nuclear fuel.
“Near the end of its nuclear burning stage, this type of star expels most of its outer material, creating a planetary nebula. Only the hot core of the star remains.
“This core becomes a very hot white dwarf, with a temperature exceeding 100,000 Kelvin.”
If the white dwarf does not surround itself with new stellar dust and gas, it will slowly lose its temperature over billions of years