+int image_getHeight(PyObject*_image) {
+#ifdef HAVE_PYTHON_IMAGING
+ if(strcmp(_image->ob_type->tp_name, "ImagingCore")) {
+ PyErr_SetString(PyExc_Exception, setError("not an image: %s", _image->ob_type->tp_name));
+ return 0;
+ }
+ ImagingObject*image = (ImagingObject*)_image;
+ return image->image->ysize;
+#else
+ PyErr_SetString(PyExc_Exception, "imaging not compiled in");
+ return 0;
+#endif
+}
+
+int image_getBPP(PyObject*_image) {
+#ifdef HAVE_PYTHON_IMAGING
+ if(strcmp(_image->ob_type->tp_name, "ImagingCore")) {
+ PyErr_SetString(PyExc_Exception, setError("not an image: %s", _image->ob_type->tp_name));
+ return 0;
+ }
+ ImagingObject*image = (ImagingObject*)_image;
+ if(!strcmp(image->image->mode, "1") ||
+ !strcmp(image->image->mode, "L") ||
+ !strcmp(image->image->mode, "P")) {
+ return 8;
+ }
+ if(!strcmp(image->image->mode, "I") ||
+ !strcmp(image->image->mode, "F")) {
+ return 32;
+ }
+ if(!strcmp(image->image->mode, "RGB") ||
+ !strcmp(image->image->mode, "RGBA") ||
+ !strcmp(image->image->mode, "CMYK") ||
+ !strcmp(image->image->mode, "YCbCr")) {
+ return 32;
+ }
+ PyErr_SetString(PyExc_Exception, setError("Unknown image format (%s).", image->image->mode));
+ return 0;
+#else
+ PyErr_SetString(PyExc_Exception, "imaging not compiled in");