< index < 5. Image toolkit | ===================================== 5.5 Getting the size of an image ===================================== |

You can read the size of an image in pixels with :

    C++ : void TCODImage::getSize(int *w,int *h) const
    C   : void TCOD_image_get_size(TCOD_image_t image, int *w,int *h)
    Py  : image_get_size(image) # returns w,h

Parameter | Description
--- | ---
image | In the C version, the image handler, obtained with the load function.
w,h | When the function returns, those variables contain the size of the image.

Example :

    C++ : TCODImage *pix = new TCODImage(80,50);
          int w,h;
          pix->getSize(&w,&h); // w = 80, h = 50
    C   : TCOD_image_t pix = TCOD_image_new(80,50);
          int w,h;
          TCOD_image_get_size(pix,&w,&h); /* w = 80, h = 50 */
    Py  : pix = libtcod.image_new(80,50)
          w,h=libtcod.image_get_size(pix)
          # w = 80, h = 50