I think the filenames and dimensions should be factored out into a dictionary constant at the top of this file so as to remove the if / elif construct here and reduce code duplication.