[Zoo-discuss] PNG Parsing in Python

Neil Davis neda at dtu.dk
Wed Aug 27 05:46:23 PDT 2014


I wrote a WPS service in Python that returns a PNG image. The output was 
defined as

<ComplexData>
     <Default>
      mimeType = image/png
     </Default>
   </ComplexData>

In python I used cStringIO, to save the PNG to in image and then passed 
it to outputs using the command:
outputs['timeseries']['value'] = img_name.getvalue()

This approach caused the last character of the PNG image string to not 
be included in the WPS XML output, as was confirmed by running:
img_name.getvalue().encode("base64").strip()

This caused a problem when rendering PNG images that ended with two 
equal-signs. For now I have added a workaround in my javascript, but I 
think this is a bug in Zoo-WPS with regards to parsing the PNG binary to 
string.

Neil




-- 

Neil Davis
Research Assistant
DTU Wind Energy

Technical University of Denmark

	
Department of Wind Energy
Risø Campus Frederiksborgvej 399, P.O. Box 49
Building 101
4000 Roskilde
Denmark
Direct +45 46775067
neda at dtu.dk <mailto:neda at dtu.dk>
www.vindenergi.dtu.dk <http://www.vindenergi.dtu.dk>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/zoo-discuss/attachments/20140827/0d5ecc42/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DTU_email_logo_01.gif
Type: image/gif
Size: 1055 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/zoo-discuss/attachments/20140827/0d5ecc42/attachment.gif>


More information about the Zoo-discuss mailing list