The world has fallen in love with the spectacular images of Jupiter NASA delivers every few months. But few people know that obtaining these photos involves a long, complicated, and sometimes even dangerous process.

To take them, the shoe-box sized camera on NASA's Juno probe has survived years of the cold wasteland of space, not to mention swooping in close to the hazardous magnetic field of the gas giant every few months during its many flybys.  

The strips of images it takes are then beamed millions of kilometres across space, before being edited by citizen scientists all over the world.

And initially they don't exactly look like the gorgeous final versions we see go viral online.

To better understand exactly how this happens, we spoke to the scientist in charge of JunoCam, as well as a citizen scientist who helps piece it all together - and we'll never look at the photos the same way again.

"Jupiter is an incredible place of terrifying danger and exquisite beauty," Seán Doran, an Irish citizen scientist and freelance artist explains to ScienceAlert. He has edited hundreds of NASA's space pictures, 

"Every flyby promises at least a handful of beautiful images."

27479980787 682abf79bf k(NASA/SwRI/MSSS/Gerald Eichstädt/Seán Doran/Flickr/CC-BY-2.0)

So how does it work? Juno launched from Cape Canaveral in August 2011, and since its arrival to Jupiter in mid-2016, it's been wowing us with colourful pictures of the gas giant.

The camera itself is called the JunoCam – the only visible colour 'camera' aboard a spacecraft filled with sensors and machines.

"You definitely could not buy this camera in the store," explains Candice Hansen-Koharcheck, Juno Co-Investigator and the Instrument Lead for JunoCam.

"The camera is what we call a push-frame visible imager. 'Push-frame' means it acquires an image a few strips at a time, which is desirable when your camera is mounted on a spinning spacecraft. We build up the long dimension of each image using the spacecraft spin to carry the camera field of view across Jupiter."

This ends up looking something like a bunch of planet pancakes, with layers and layers stacked on top of each other.

planet pancakes jupiter(JunoCam/NASA)

"We have filters mounted on the detector for red, green and blue… We also have a methane filter, for a wavelength band longer than normal human vision to study cloud heights," she added.

Juno has made a flyby approximately every two months since it arrived, its elliptical orbit taking it as close to 4,200 kilometres (2,600 miles) before flying back as far as 8.1 million kilometres from the planet. On each flyby, JunoCam can take between 12 and 20 images.

That might not seem like a lot, but getting the images across at least 600 million kilometres of space isn't a walk in the park.

Across those distances, it can take an hour or more for even the tiniest bit of information to reach Earth.

Once the flyby is complete, "the data is stored on the spacecraft and the most important engineering and magnetometer data is sent back first," says Hansen-Koharcheck. 

"Then we start a round-robin of all the instruments, which means JunoCam gets about 6 minutes per hour for images to be returned."

41431194215 237c8b5a95 k(NASA/SwRI/MSSS/Gerald Eichstädt/Seán Doran/Flickr/CC-BY-2.0)

This can take a couple of days to complete, as long as everything goes to plan.

The JunoCam has held its own in Jupiter's extremely hostile environment longer than anyone expected it would.

Juno can protect most of its other equipment inside heavy shielding boxes. But charged particles trapped in Jupiter's magnetic field lines (called the magnetosphere) can damage the camera, which can't be shielded in the same way.

The intense magnetosphere was expected to knock the camera out of action by its eighth flyby – but it's still going strong after 12 – each time providing more images to be processed.

Once all the images make it back to Earth, it's time for editing, but it's not actually NASA scientists putting in most of the work.

"The images we take with JunoCam are definitely scientifically valuable.  We are using them to study the cyclones that encircle Jupiter's poles for example," explains Hansen-Koharcheck. 

"But, the primary purpose for JunoCam was to provide a means for the public to participate in the mission."

There's a whole community of people online that take these pancaked planets, and slowly edit them into the pictures or videos we end up seeing.

"There are numerous collaborations happening with people from all over the world," said Doran.

"I started learning by wading directly into the deepest part of image processing and making lots and lots of mistakes."

"The community is very active on social media, and discussion forums like UMSF (Unmanned I enjoy sharing the excitement of new discoveries," says Doran.

The citizen scientist's skill level determines whether they work on one of the many images already processed by 'super-experts' or start with the planet pancakes. The image processing time can vary between one hour to as much as 12 hours or more, depending on how complicated the image series is.

"There is a huge subjective component to working with images of exotic bodies like other planets, especially ones like Jupiter. We are looking at an alien environment which is not fully understood so there is a lot of poetry to be mined from those observations," said Doran.

"I take the source image through a sequence of colour corrections, exposure corrections, artefact repairs and remix these layered edits using a range of blend modes as well as lens effects to approximate a natural finish."

41619829604 07fc943105 k(NASA/SwRI/MSSS/Gerald Eichstädt/Seán Doran/Flickr/CC-BY-2.0)

While Juno was originally scheduled to perform its last flyby in July 2018, NASA has now extended the mission for at least an extra three years.

We can't wait to see what's next.