alexwlchan / alexwlchan.net

Source code and plugins for my website, a static site built with Jekyll
https://alexwlchan.net/
MIT License
42 stars 12 forks source link

Improve the way images are built #815

Closed alexwlchan closed 4 months ago

alexwlchan commented 4 months ago

Recently while doing some image rebuilds I spotted a warning coming from the image conversions:

/Users/alexwlchan/repos/alexwlchan.net/.venv/lib/python3.12/site-packages/PIL/Image.py:1000: UserWarning: Palette images with Transparency expressed in bytes should be converted to RGBA images

I did some investigating – this turns out to be my old friend, opacity in AVIF images, which I tracked down to https://github.com/fdintino/pillow-avif-plugin/issues/48. I've added a workaround for it in the Python script.

Along the way, I was able to speed up the process of creating images by ~6x by batching requests and adding concurrency. 💪

alexwlchan commented 4 months ago

To make sure I've caught all the instances of this, I'm doing a local rebuild of all the images, and checking for this warning.

alexwlchan commented 4 months ago

🚀 Deployed on https://66301c87198d272ae0650e57--alexwlchan.netlify.app

alexwlchan commented 4 months ago

And now I've switched back to a queuing approach I used to use, where all the requests get written so a single file then processed all at once, but now I'm taking a bit more advantage of that by adding a ✨ progress bar ✨ so I can tell how long the processing is going to take.

alexwlchan commented 4 months ago

Sweet! No more warnings, I think this issue is fixed. 💪