Page 1 of 1

From convert to C++/Python/Perl API, how?

Posted: 2008-10-07T14:39:04-07:00
by grego
How would I do
convert t1.png -quantize YUV +dither -colors 16 -depth 4 t2.png
from a script?

I took a look at PythonMagick which did not include any documentation, but I gathered that the Magick++ documentation is close. So my attempt was following:

from PythonMagick import Image
i = Image('t1.png')
i.quantizeColors(16)
i.quantizeDither(True)
i.quantize()
i.depth(4)
i.write('t2.png')

The above is just guesswork which seems to do something, but result is not the same as the convert even if I remove the colorspace YUV from convert. I didn't see how to I could create a colorspace in PythonMagick, perhaps that is just a missing feature...

Anyway, I'd be happy with an example in PerlMagick, MagickWand or what ever that would do the trick.

Thanks