Trimming Excess Padding From Mascot PNGs
This note captures the exact steps we used to remove the large transparent borders
around the Axiom mascot assets in docs/img/mascot/*.png. The goal is to keep them
tight so our custom admonition layout has consistent spacing.
1. Install Pillow
1 | |
We already have MkDocs’ requirements installed; Pillow is the extra dependency needed for basic image manipulation.
2. Run the Cropping Script
Execute the following command from the repository root:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
THRESH = 10treats any pixel whose alpha value is 10 or less as “padding.” This cuts off the soft halo without touching the owl.PADDING = 4restores a thin buffer so the artwork doesn’t feel cramped.
3. Rebuild the Site
1 | |
Rebuilding (or restarting mkdocs serve) ensures the optimized assets propagate
to site/**.
Notes
- The script overwrites the original PNGs. Commit the updated images to keep the tighter version.
- If future assets have heavier halos, adjust
THRESHorPADDINGto taste.