Python Script Converts 500 PNGs to JPG in 6.7 Seconds, Benchmarked Against Alternatives
A developer needed hundreds of PNG images converted to JPG to meet a content management system's 25 MB per-image limit. They wrote a Pillow-based Python script that flattens transparent images onto a white background, handles palette-mode files, and writes output to a separate folder to protect originals. Running on a MacBook with Python 3.13, the script processed 500 images of 800×600 pixels in 6.7 seconds, reducing total size from about 745 MB to 172 MB. The author notes that real photos and screenshots typically compress better than the noise images used in the test. The post also acknowledges that for one-off jobs, on other people's machines, or for non-technical users, a browser-based converter may be more practical.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in