Converting 100 SVGs to PNGs on Windows: The Selenium Headless Trick
Table of Contents The Problem: SVG to PNG on Windows Alternatives We Tried (and Why They Failed) The Selenium Solution Setup: Chrome + ChromeDriver + Selenium Converting a Single SVG Batch Processing 100 Files Quality Considerations Post-Processing with Pillow We had 100 SVG artworks generated by quantum computers for the Quantum Genesis collection. We needed PNGs to upload to IPFS (SVG support varies across NFT platforms and wallets). On Linux or macOS, you'd use cairosvg and be done in five minutes. We were on Windows. It took considerably longer than five minutes. This post documents the problem, the failed attempts, and the solution that actually worked: using Selenium with headless Chrome to screenshot SVGs into pixel-perfect PNGs. The Problem: SVG to PNG on Windows SVG (Scalable Vector Graphics) is an XML-based format. Converting it to a raster format like PNG requires an SVG rendering engine — something that can parse the XML, execute the gradient definit...