[mapserver-users] Create imageObject failed in python binding.

Shawn Gao gaohawk at gmail.com
Sat Aug 17 19:59:42 PDT 2013


Hi, All,

Official document on mapserver site said use following way to create an
imageObject instance in python. look at this
link<http://mapserver.org/mapscript/mapscript.html#imageobj>

new imageObj( int width, int height [,
outputFormatObj<http://mapserver.org/mapscript/mapscript.html#outputformatobj>
format=NULL
[, string filename=NULL ] ] ) : imageObj

So I create imageObject in Python by this,

mapscript.imageObj(100,100,"GD/PNG", '
http://mapserver.org/_static/banner.png')

But get error, "Segmentation fault (core dumped)".

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.

    def testConstructorUrlStream(self):
        """imageObj with a URL stream works"""
        url = urllib.urlopen('http://mapserver.org/_static/banner.png')
        imgobj = mapscript.imageObj(url, 'GD/JPEG')
        assert imgobj.thisown == 1
        assert imgobj.height == 68
        assert imgobj.width == 439
        imgobj.save('testConstructorUrlStream.jpg')


What's the correct way to create an imageObject from url or file?

Thanks,
Shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130818/30ec1abd/attachment.html>


More information about the mapserver-users mailing list