dangeng/visual_anagrams

Code for the paper "Visual Anagrams: Generating Multi-View Optical Illusions with Diffusion Models"

What it solves

This project creates "visual anagrams"—images that appear as one thing when viewed normally, but transform into a different identity or appearance when manipulated. These transformations can include rotations, color inversions, jigsaw rearrangements, or pixel permutations.

How it works

The system uses a pixel-based diffusion model (DeepFloyd IF) rather than a latent diffusion model to avoid artifacts that typically occur in optical illusions. It generates images that satisfy multiple prompts simultaneously across different "views" (transformations). For example, it can create an image that looks like a snowy mountain village in its original state and a horse when rotated 90 degrees.

Who it’s for

Artists, researchers, and creators interested in generative AI and optical illusions who want to produce complex, multi-view visual puzzles.

Highlights

  • Multi-View Support: Supports a wide variety of transformations including rotations, flipping, jigsawing, inner-circle rotations, color negation, and skewing.
  • High Resolution: Capable of generating images up to 1024x1024 using a multi-stage upscaling process.
  • Customizable: Allows users to define their own custom views by deriving from a base class or using pixel permutation arrays.
  • Animation Tools: Includes a script to animate the transition between the original image and its transformed state.