NASA joined in with the Halloween spirit and released ghostly photos of nebulae, which are the material coming from stars on the brink of death.

William Herschel mistakenly named nebulas after their resemblance to planets in the late 1700s, a NASA news release reported. 

"Some might call the images haunting," Joseph Hora of the Harvard-Smithsonian Center for Astrophysics, Cambridge, Mass., principal investigator of the Spitzer observing program, "We look to the pictures for a sense of the history of the stars' mass loss, and to learn how they evolved over time."

One day our own Sun will die the same spectacular death as the stars portrayed in the images. As stars get older and run out of fuel they puff up into "red giants," which eventually shed their outer layer.

"When ultraviolet light from the core of a dying star energizes the ejected layers, the billowy material glows, bringing their beautiful shapes to light," the news release reported.

Nebulas come in a number of shapes. All three of the newly released images were taken by the Spitzer telescope.

The first image shows what has been nicknamed the Exposed Cranium Nebula because of its resemblance to a brain. Formally called PMR 1, the nebula is about 5,000 light-years away from Earth and located in the Vela constellation.

Its parent star is losing its mass extremely quickly. The nebula itself is made up of ionized gas on the inside and cooler hydrogen molecules on the outside.

The second image represents the "Ghost of Jupiter," NGC 3242, which is 1,400 light-years away in the constellation Hydra. The infrared image reveals the perishing star's cool outer halo, which can be seen in red.

"Also evident are concentric rings around the object, the result of material being tossed out periodically during the star's fitful death," the news release reported.

The last image shows a nebula with a slightly less spooky name: The Little Dumbbell Nebula. The planetary nebula called NGC 650 is located about 2,500 light-years from Earth in the Perseus constellation. It is "butterfly shaped," due to a thick disk running across it caused by harsh winds.