473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

PythonMagick_writeImages

I'm trying to get PythonMagick going using ....

Enthought Edition Python 2.3
PythonMagick-0[1].5-Q16.python23.win32.exe

The following small example script from the old PythonMagick tutorial
worked for me just as coded below using Python 2.2.1 and an earlier release
of PythonMagick, which has been uninstalled, but now throws
TypeError: bad argument type when calling the writeImages( .... ) function ....

# animate1.py --------------------------------------------------------------

from PythonMagick import *

img1 = Image( './img/01.jpg' )

img1.scale( "100x100" )

img2 = Image( img1 )

img2.blur( 5 , 1.5 )

imgs = animateImages( [ img1 , img2 ] )

writeImages( imgs , './out/a1_kirstin.gif' , 1 ) # Line 14 .... Problem occurs here

# ------------------------------------------------------

python animate1.py
Traceback (most recent call last):
File "animate1.py", line 14, in ?
writeImages( imgs , './out/a1_kirstin.gif' , 1 )
TypeError: bad argument type for built-in operation
Magick: Failed to close module ("UnregisterJPEGImage: The operation completed successfully.").

# ---------------------------------------------------------

The only documentation I've found about writeImages()
is from some Magick++ docs, but I'm unsure how to
actually interpret it as my C++ experience is almost non-existent ....

http://www.imagemagick.org/www/Magick++/STL.html

writeImages InputIterator first_,
InputIterator last_,
const std::string &imageSpec_,
bool adjoin_ = true
Write images in container to file specified by string imageSpec_.

Set adjoin_ to false to write a set of image frames via a wildcard imageSpec_
(e.g. image%02d.miff).

The wildcard must be one of %0Nd, %0No, or %0Nx.

Caution: if an image format is selected which is capable of supporting fewer colors
than the original image or quantization has been requested, the original image will be
quantized to fewer colors. Use a copy of the original if this is a problem.

# ---------------------------------------------------------------------------------------------------

All of the other PythonMagick examples from the original tutorial
seem to work OK except the two that compose animated GIFs
using the writeImage function ....

Any clues ????

--
Cousin Stanley
Human Being
Phoenix, Arizona

Jul 18 '05 #1
2 5430
"Cousin Stanley" <Co***********@hotmail.com> wrote in message
news:bp*************@ID-130333.news.uni-berlin.de...

Hi,
TypeError: bad argument type for built-in operation
Magick: Failed to close module ("UnregisterJPEGImage: The operation

completed successfully.").

the last line seems to be the real error. PythonMagick is only a wrapper
around GraphicsMagick. To me it looks like this is not a problem of the
wrapper, but of GraphicsMagick. You might subscribe to the GraphicsMagick
APIs Mailinglist and ask Bob about this error.

regards,
Achim
Jul 18 '05 #2
Achim ....

This problem doesn't seem to be unique to JPG files
and also shows up with the wxPython/PythonMagick example
in the current tutorial posted at ....

http://www.procoders.net/moinmoin/PythonMagick

python wxp_pm.py
Magick: Failed to close module ("UnregisterPNGImage: The operation completed suc
cessfully.
").
Magick: Failed to close module ("UnregisterRGBImage: The operation completed suc
cessfully.

As with most of the simple examples from the original PythonMagick tutorial,
with the exception of the writeImages function noted in my original post
and a different problem with example4.py , this wxp_pm.py program seems to do
the desired image processing as expected in spite of the Failed to close module
error ....

The versions of the original PythonMagick tutorial that I use
along with their output images can be found at ....

http://fastq.com/~sckitching/Python/...gick_tut_0.zip
[ 248 KB ]

It would be interesting to know if these run OK
with the Standard Python 2.3 distribution in order
to determine if there might be some quirk with
the Enthought Edition or with my setup ....

In the meantime, I will look for the GraphicsMagick API mailing list ....

--
Cousin Stanley
Human Being
Phoenix, Arizona

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.