+ static char *kwlist[] = {"image", "quant", NULL};
+ int quant=7;
+ PyObject* array = 0;
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i", kwlist, &array, &quant))
+ return NULL;
+
+ signed char* movex = malloc(fi->stream->bbx * fi->stream->bby);
+ signed char* movey = malloc(fi->stream->bbx * fi->stream->bby);
+ signed char* itx=movex;
+ signed char* ity=movey;
+ int x,y;
+ if(!array || !PySequence_Check(array))
+ return PY_ERROR("Not an array");
+ if(PySequence_Length(array) < fi->stream->bby)
+ return PY_ERROR("Array (y) has to have at least %d elements, but has only %d ", fi->stream->bby, PySequence_Length(array));
+ for(y=0;y<fi->stream->bby;y++) {
+ PyObject*line = PySequence_GetItem(array, y);
+ if(!line || !PySequence_Check(line))
+ return PY_ERROR("Not an array of arrays");
+ if(PySequence_Length(line) < fi->stream->bbx)
+ return PY_ERROR("Inner arrays (x) have to be at least %d long- %dth is only %d", fi->stream->bbx, y, PySequence_Length(line));
+
+ for(x=0;x<fi->stream->bbx;x++) {
+ PyObject*pixel = PySequence_GetItem(line, x);
+ if(!pixel) {
+ *itx = 0;
+ *ity = 0;
+ } else {
+ if(!PyComplex_Check(pixel)) {
+ return PY_ERROR("Not an array of arrays of complex numbers");
+ }
+ *itx = (signed char)PyComplex_RealAsDouble(pixel);
+ *ity = (signed char)PyComplex_ImagAsDouble(pixel);
+ }
+ itx++;
+ ity++;
+ }
+ }
+