You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add post-build script to fix animated GIF thumbnails
- Created docs/post_build.py to copy GIF thumbnails and update HTML references
- Added comprehensive documentation in docs/ANIMATED_THUMBNAILS.md
- Script works around sphinx-gallery limitation with GIF thumbnail paths
- Enables animated thumbnails to display properly on Read the Docs
- Includes instructions for local development and Read the Docs integration
Root cause: sphinx-gallery ignores sphinx_gallery_thumbnail_path for GIFs
Solution: Post-build processing to copy GIFs and update HTML references
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
The gallery thumbnails for animated examples (chemtrails, animate_MDS, animate_spin, animate, precog, save_movie) were not displaying as animated GIFs. Instead, they showed static PNG thumbnails or placeholder images.
5
+
6
+
## Root Cause
7
+
Sphinx-gallery ignores the `sphinx_gallery_thumbnail_path` directive when it points to GIF files and generates PNG thumbnails instead. The GIF files are properly stored in version control but need to be manually copied and HTML references updated after the build.
8
+
9
+
## Solution
10
+
A post-build script (`docs/post_build.py`) has been created that:
11
+
12
+
1.**Copies GIF thumbnails**: Moves animated GIF files from `docs/_static/thumbnails/` to `docs/_build/html/_images/`
13
+
2.**Updates HTML references**: Replaces PNG thumbnail references with GIF references in the gallery HTML
14
+
15
+
## Usage
16
+
17
+
### Local Development
18
+
After building documentation locally:
19
+
```bash
20
+
cd docs/
21
+
make html
22
+
python post_build.py
23
+
```
24
+
25
+
### Read the Docs Integration
26
+
For Read the Docs, add this to your `.readthedocs.yaml`:
However, sphinx-gallery generates PNG thumbnails regardless of this directive when pointing to GIF files. The post-build script works around this limitation by:
81
+
82
+
1. Copying the actual GIF files to the correct location
83
+
2. Updating the HTML to reference the GIF files instead of PNG files
84
+
85
+
## Verification
86
+
87
+
After running the post-build script:
88
+
1. Check that GIF files exist in `docs/_build/html/_images/`
89
+
2. Open `docs/_build/html/auto_examples/index.html` in a browser
90
+
3. Verify that animated examples show moving thumbnails
91
+
4. Verify that static examples (explore, save_image, analyze) show custom static thumbnails
92
+
93
+
## Maintenance
94
+
95
+
When adding new animated examples:
96
+
1. Create the animated GIF thumbnail (50fps, infinite loop)
97
+
2. Add the GIF to `docs/_static/thumbnails/`
98
+
3. Add `sphinx_gallery_thumbnail_path` comment to the example
99
+
4. Update `GIF_REPLACEMENTS` dictionary in `docs/post_build.py`
0 commit comments