Use StringIO to prevent image -> string -> image and associated truncation.
Make requests for tiles and grids to CKAN rather than directly to windshaft.