explaingit

jcjohnson/neural-style

18,285LuaAudience · vibe coderComplexity · 3/5DormantLicenseSetup · hard

TLDR

Apply the artistic style of one image to the content of another using neural networks. Create paintings that blend a photo's subject with a famous artwork's brushstrokes.

Mindmap

mindmap
  root((repo))
    What it does
      Blend content and style
      Artistic photo transformation
      Multi-style mixing
    How it works
      Neural networks
      Feature extraction
      Style transfer algorithm
    Use cases
      Artistic photo effects
      Creative image generation
      Style experimentation
    Tech stack
      Torch framework
      Lua language
      GPU acceleration
    Inputs and outputs
      Content image
      Style image
      Stylized output

Things people build with this

USE CASE 1

Transform photographs into paintings styled after famous artworks or personal artistic references.

USE CASE 2

Create variations of images by blending multiple artistic styles with adjustable weights.

USE CASE 3

Generate stylized versions of photos while preserving original colors or textures.

Tech stack

LuaTorchCUDANeural networks

Getting it running

Difficulty · hard Time to first run · 1day+

Requires CUDA GPU, Torch/Lua environment setup, and pre-trained neural network models which may need downloading.

Use freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

Neural-style is an implementation of a technique that combines the visual content of one photograph with the artistic style of another image using neural networks (a type of AI modeled loosely on the brain). The underlying idea, from a research paper by Leon Gatys, Alexander Ecker, and Matthias Bethge, is that a neural network can separately identify what is in an image (its content) and how it looks (its style), then blend content from one source with style from another. The result is a new image that looks like the content photo repainted in the manner of the style image. For example, you could take a photograph of a city street and render it as if painted in the brushstroke style of a famous painting. The user can control how much weight to give the content versus the style, producing results that range from a barely-stylized photo to something almost entirely abstract. You can also blend multiple style images together, controlling each one's contribution, or keep the original colors of the content image while adopting only the texture and pattern of the style. Built using the Torch numerical computing framework and written in the Lua programming language, this was an early and influential implementation that demonstrated the technique's potential. Running it requires a graphics card for practical speed, and various pretrained neural network models for feature extraction.

Copy-paste prompts

Prompt 1
How do I use neural-style to turn my vacation photo into a Van Gogh painting?
Prompt 2
Show me how to blend two different artistic styles on the same photo using neural-style.
Prompt 3
What GPU setup do I need to run neural-style efficiently on my own images?
Prompt 4
How can I adjust the content-to-style ratio to get more or less artistic abstraction in neural-style?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.