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