Do you really need to specifiy the dpi? It doesn't have any effect on the result does it? (Would matplotlib cope if you just hard-wired this to 1?)