This project creates a pixel-accurate HTML5 reproduction of the classic Space Jam website from a screenshot. The webpage scales responsively with the browser window while maintaining exact relative positioning of all elements.
- Used OpenCV's multi-scale template matching to locate each navigation element
- Scales tested: 0.5x to 2.0x in 30 steps
- Handled alpha channel transparency in GIF images
- Applied SIFT feature detection and FLANN-based matching
- Used RANSAC (Random Sample Consensus) to robustly estimate global scale factor
- Global scale factor: 1.276 (images in screenshot are scaled up from original GIFs)
- Used Lucas-Kanade sparse optical flow for sub-pixel position refinement
- Detected good features to track in template images
- Calculated median displacement for robust offset estimation
- Firefox headless rendering for pixel-accurate comparison
- Template matching to verify final element positions
- All elements within <2px offset from original
| Metric | Value |
|---|---|
| Screenshot dimensions | 2486 x 1265 px |
| Global scale factor | 1.276 |
| Image similarity | 84.56% |
| Max element offset | <2 pixels |
| Element | Confidence | Offset |
|---|---|---|
| Logo | 0.920 | <2px |
| Planet B-Ball | 0.927 | <2px |
| Jam Central | 0.931 | <2px |
| Lunar Tunes | 0.908 | <2px |
| Press Box Shuttle | 0.884 | <2px |
| The Lineup | 0.955 | <2px |
| Junior Jam | 0.934 | <2px |
| Stellar Souvenirs | 0.955 | <2px |
| Jump Station | 0.972 | <2px |
| Warner Studio Store | 0.910 | <2px |
| Behind the Jam | 0.859 | <2px |
| Site Map | 0.895 | <2px |
index.html- Pixel-accurate, responsive webpage
measure_objects.py- Feature detection with multi-scale template matching and RANSACrefine_positions.py- Optical flow-based position refinementcreate_comparison.py- Visual comparison generatoranalyze_footer.py- Footer text position analysis
measurements/measurements.json- Detected positions and scale factorsmeasurements/refinements.json- Position refinement datameasurements/detections.jpg- Visualization of detected elementsmeasurements/html_render.png- Firefox rendering of HTMLmeasurements/overlay_50_50.jpg- 50/50 blend comparisonmeasurements/highlight_diff.jpg- Difference visualization
The remaining 15% difference comes from the star background tiling. The bg_stars.gif background repeats across the page, but the tiling origin in the HTML cannot perfectly match the original screenshot's tiling phase. All actual content elements (logo, planets, text) are pixel-accurately positioned.
The webpage uses percentage-based CSS positioning:
- Container maintains original aspect ratio (50.88% padding-top)
- All elements positioned using
leftandtoppercentages - Element widths calculated as percentage of viewport
transform: translate(-50%, -50%)centers elements on their anchor points
Open index.html in any modern browser. The page will scale proportionally with the window size while maintaining the exact layout of the original Space Jam website.
pixel diff
50-50 overlay