<div dir="ltr">Shawn,<div>I have briefly checked the python mapscript sources and I am afraid the you might have hit a bug.</div><div>Python mapscript has a special, more pythonic imageObj constructor which seems to depend heavily on GD code</div>
<div>and that possibily explains the error you are experiencing.</div><div><br></div><div>Would you mind opening an issue at:</div><div><br></div><div><a href="https://github.com/mapserver/mapserver/issues/new">https://github.com/mapserver/mapserver/issues/new</a><br>
</div><div><br></div><div>Please state the mapserver version and, if built from sources, the options used.</div><div>It would greatly speed up the resolution process if you could build mapserver/mapscript from the git sources.</div>
<div><br></div><div>BR,</div><div>Umberto</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 18, 2013 at 4:59 AM, Shawn Gao <span dir="ltr"><<a href="mailto:gaohawk@gmail.com" target="_blank">gaohawk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, All,<div><br></div><div>Official document on mapserver site said use following way to create an imageObject instance in python. look at <a href="http://mapserver.org/mapscript/mapscript.html#imageobj" target="_blank">this link</a></div>

<div><br></div><div><span style="color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px">new imageObj( int width, int height [, </span><a href="http://mapserver.org/mapscript/mapscript.html#outputformatobj" style="color:rgb(26,26,86);font-family:Arial,sans-serif;font-size:13px" target="_blank">outputFormatObj</a><span style="color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px"> format=NULL [, string filename=NULL ] ] ) </span><span style="color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px">:</span><span style="color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px"> </span><span style="font-style:oblique;color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px">imageObj</span><br>

</div><div><span style="font-style:oblique;color:rgb(62,67,73);font-family:Arial,sans-serif;font-size:13px"><br></span></div><div><font color="#3e4349" face="Arial, sans-serif">So I create imageObject in Python by this,</font></div>

<div><font color="#3e4349" face="Arial, sans-serif"><br></font></div><div><font color="#3e4349" face="Arial, sans-serif">mapscript.imageObj(100,100,"GD/PNG", '<a href="http://mapserver.org/_static/banner.png" target="_blank">http://mapserver.org/_static/banner.png</a>')<br>

</font></div><div><font color="#3e4349" face="Arial, sans-serif"><br></font></div><div><font color="#3e4349" face="Arial, sans-serif">But get error, "Segmentation fault (core dumped)</font><span style="color:rgb(62,67,73);font-family:Arial,sans-serif">".</span></div>

<div><span style="color:rgb(62,67,73);font-family:Arial,sans-serif"><br></span></div><div><span style="color:rgb(62,67,73);font-family:Arial,sans-serif">Then I check the test case of python binding. The test case for imageObject is in imagetest.py. I try it firstly. Then many cases failed, include the case for create imageObject instance. I found the create method in test script is in other way.</span></div>

<div><span style="color:rgb(62,67,73);font-family:Arial,sans-serif"><br></span></div><div><span style="color:rgb(62,67,73);font-family:Arial,sans-serif"><div>    def testConstructorUrlStream(self):</div><div>        """imageObj with a URL stream works"""</div>

<div>        url = urllib.urlopen('<a href="http://mapserver.org/_static/banner.png" target="_blank">http://mapserver.org/_static/banner.png</a>')</div><div>        imgobj = mapscript.imageObj(url, 'GD/JPEG')</div>
<div>        assert imgobj.thisown == 1</div>
<div>        assert imgobj.height == 68</div><div>        assert imgobj.width == 439</div><div>        imgobj.save('testConstructorUrlStream.jpg')</div><div><br></div><div><br></div><div>What's the correct way to create an imageObject from url or file?</div>

<div><br></div><div>Thanks,</div><div>Shawn</div></span></div></div>
<br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br></div>