It is a question often asked by clickbait websites and authors of internet memes: Has science gone too far?

Just in time for Halloween, researchers at MIT have created an algorithm they call the "Nightmare Machine," which uses artificial intelligence to transform photographs into spooky tableaus.

The technology, called "deep learning," has previously been put to more benign use -- most famously with Google's DeepDream, which had a tendency to turn photographs into a mashup of dogs and eyeballs.

While those images can be unsettling, MIT's project is deliberately creepy. The algorithm can use filters like "slaughter house," "toxic city" and "alien invasion" to turn landscape photographs into horror film backdrops.

A photo posted by Nightmare Machine (@nightmare_machine) on Oct 24, 2016 at 9:57pm PDT

The algorithm has also been used to generate and distort human faces, to unnerving effect. Ellen Degeneres, for example, has never looked so scary:

In an interview with the Boston Globe, Nightmare Machine co-creator Manuel Cebrian said the project was designed as a Halloween treat that plays with societal fears about artificial intelligence.

"We found it appropriate to explore how machines, themselves, can generate the scary content," Cebrian told the Globe. "So we launched the Nightmare Machine."

Visitors to the project's web site can watch examples of the algorithm at work, like this transformation of daytime New York City into its Ghostbusters equivalent.