There should be some try/catch in here, the least of which being if settings.PNGCRUSH_BIN is blank or unset.