A toolkit for generating anamorphic art through computational pixel mapping. This project enables the creation of distorted images that resolve into recognizable forms when viewed from specific angles or reflected in carefully positioned mirrors.
Source Image transforms into Target Configuration
Pixel-by-pixel mapping in action
- Priority-based pixel mapping for optimal visual quality
- Configurable balance between color accuracy and spatial coherence
- Progressive visualization of the mapping process
- STL generation for 3D-printable mirror arrays (in development)
- Real-time progress tracking with GIF generation
# Clone the repository
git clone https://github.com/yourusername/looking-glass.git
# Dependencies
- Kotlin 1.5+
- Java 11+// Basic usage
val mapper = PriorityBasedMapper(
sourceImage = ImageIO.read(File("source.png")),
targetImage = ImageIO.read(File("target.png")),
priorityMap = PriorityMapGenerator.radial(),
maxK = 40000,
colorWeight = 0.95,
spatialWeight = 0.05
)
val mapping = mapper.computeMapping()Key parameters that affect the mapping:
maxK: Maximum number of neighbors to consider (default: 40000)minK: Minimum number of neighbors to consider (default: 100)colorWeight: Importance of color matching (0.0-1.0)spatialWeight: Importance of spatial coherence (0.0-1.0)switchThreshold: Point at which algorithm switches search strategies
The mapping process generates a real-time GIF showing the progressive construction of the image:
- ✅ Basic pixel mapping framework
- ✅ Priority-based processing
- ✅ Progress visualization
- 🚧 Mirror array generation (in development)
- 🚧 Physical optimization constraints
- 📋 Cylindrical mirror support (planned)
The project implements anamorphic mapping through a priority-queue-based algorithm that:
- Processes pixels in order of visual importance
- Maintains both local color accuracy and global spatial relationships
- Adapts search complexity based on pixel priority
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project draws inspiration from:
- Historical anamorphic art techniques
- Modern computational geometry
- Digital image processing algorithms
Questions? Ideas? Feel free to open an issue or reach out directly.
Note: This project is currently under active development. Some features may be incomplete or subject to change.



