Raging Sloth Tech

PNG Optimizer Tutorials

As the number of PNG Optimizer tutorials has increased the Software Engineering Section Menu is becoming unwieldily so I've decided to put up this index page.

PNG Optimizer - A basic tutorial on creating a python script. Talks about general thinking when developing and ends with a script to recursively locate png files and run optimizing programs on them. According to Google this tutorial is usually used as example code by people who want to know more about the listdir function.

PNG Optimizer Cleanup - Refactoring the script created in the original PNG Optimizer tutorial. Makes the script much simpler and easier to deal with. This refactored script is used in the follow on parallelization tutorial.

PNG Optimizer Parallelization - I named this multithreading originally and left the name in place for the sake of search engines :) The script is actually based around multiprocessing but in general the same elements are involved. Makes the script parallel and capable of using an arbitrary number of processor cores using the python multiprocessing module. Talks about generic issues related to running parallel code and deciding how to divide up tasks. As a result of the final solution it also touches on simple generators (as it uses imap_unordered). In writing this I googled around a bit for example code on python multiprocessing pools and didn't find a whole lot, so if you're interested in them you could do a lot worse :)

Optimizer - Becoming more generic - This is a quick little tutorial to talk about making the PNG optimizer more generic and capable of processing multiple file types.