Passing list to PythonMagick.Image.draw()
Posted: 2012-02-20T02:26:39-07:00
Hello!
I have successfully built and done some simple tests with PythonMagick-0.9.7, like reading and wrinting images.
BUT...
When I try to do a bit more complex stuff I run into problems. I want to draw a simple rectangle with transparent fill. Correct me if I'm wrong, but to do this I need to send multiple arguments to the draw command in a list. The problem is that PythonMagick doesn't except anything else then a C++ std::list of arguments. I've tried sending a python list with no result. Is this a limitation in the wrapper or am I missing a list function/class somewhere?
Is there any way of sending this kind of list from python?
here's what I'm trying to do:
I've also tried:
..and..
Thanks for you time,
-Daniel
I have successfully built and done some simple tests with PythonMagick-0.9.7, like reading and wrinting images.
BUT...
When I try to do a bit more complex stuff I run into problems. I want to draw a simple rectangle with transparent fill. Correct me if I'm wrong, but to do this I need to send multiple arguments to the draw command in a list. The problem is that PythonMagick doesn't except anything else then a C++ std::list of arguments. I've tried sending a python list with no result. Is this a limitation in the wrapper or am I missing a list function/class somewhere?
Is there any way of sending this kind of list from python?
here's what I'm trying to do:
Code: Select all
import PythonMagick as pm
im = pm.Image('1920x1080', 'gray70')
stroke = pm.DrawableStrokeColor(pm.Color(0,0,0,0))
fill = pm.DrawableFillColor(pm.Color(0,0,0,65535))
rectangle = pm.DrawableRectangle(20,20,1900,1060)
args = [stroke, fill, rectangle]
im.draw(args)
im.magick('PPM')
im.display()
Code: Select all
im.draw(*args)
Code: Select all
im.draw(stroke)
im.draw(fill)
im.draw(rectangle)
-Daniel