Researchers at Massachusetts Institute of Technology used artificial intelligence to give people some spooky and scary images just a few days before Halloween.

The new AI, dubbed as "Nightmare Machine" is a series of algorithm designed to generate creepy images out of an ordinary photos.

"We use state-of-the-art deep learning algorithms to learn what haunted houses, ghost towns or toxic cities look like," explained Yanardag Delul, a researcher at MIT Media Lab, in a report from Washington Post.

The Nightmare Machine works by incorporating the viewers' preference of what scary looks like. It acts like a game where a viewer could rate an eerie image of a face as "scary" or "not scary." Based on the viewers' response, Nightmare Machine would generate an image that can match what the viewer may find as absolutely terrifying image.

MIT researchers also incorporated Google's Deep Dream method in their Nightmare Machine. However, unlike Google's creepy images of trees being reworked as church steeples or faces appearing in unusual places, Nightmare Machine is designed to produce hellish reworks of normal photo to generate fear.

Additionally, Google's Deep Dream has a constant input of animal photographs, making the AI more inclined to see images of animals in a photo. On the other hand, MIT researchers fed the Nightmare Machine a steady diet of haunted houses, ghost towns and toxic cities.

The AI remaster ordinary images into pure horror scene by adding inky veins or creeping roots in the photos of the world's landmark. Nightmare Machine also plays with different styles of contrasting and shading to make the background of the photo uncomfortable to the human eyes. Faces are also distorted with some tidbits of red hue and darken skin tone.

According to the report from Quartz, the Nightmare Machine uses two main techniques to generate horror-style transfer and generative adversarial network. Despite being fully understood and published just last year. Researchers from MIT have already mastered the use of those technique and incorporate it to a project that can sure bring additional fun and nightmare this coming Halloween.