def imageSize(self, path):
        """
        Return the `width` and `height` of an image.

        .. showcode:: /../examples/imageSize.py
        """
        if isinstance(path, self._imageClass):
            path = path._nsImage()
        if isinstance(path, AppKit.NSImage):
            rep = path.TIFFRepresentation()
            _isPDF = False
        else:
            if isinstance(path, (str, unicode)):
                path = optimizePath(path)
            if path.startswith("http"):
                url = AppKit.NSURL.URLWithString_(path)
            else:
                if not os.path.exists(path):
                    raise DrawBotError("Image does not exist")
                url = AppKit.NSURL.fileURLWithPath_(path)
            _isPDF, _ = isPDF(url)
            # check if the file is an .eps
            _isEPS, epsRep = isEPS(url)
            if _isEPS:
                _isPDF = True
                rep = epsRep
            else:
                rep = AppKit.NSImageRep.imageRepWithContentsOfURL_(url)
        if _isPDF:
            w, h = rep.size()
        else:
            w, h = rep.pixelsWide(), rep.pixelsHigh()
        return w, h
    def imageSize(self, path, pageNumber=None):
        """
        Return the `width` and `height` of an image.

        .. showcode:: /../examples/imageSize.py
        """
        if isinstance(path, self._imageClass):
            path = path._nsImage()
        if isinstance(path, AppKit.NSImage):
            rep = path.TIFFRepresentation()
            _isPDF = False
        else:
            if isinstance(path, (str, unicode)):
                path = optimizePath(path)
            if path.startswith("http"):
                url = AppKit.NSURL.URLWithString_(path)
            else:
                if not os.path.exists(path):
                    raise DrawBotError("Image does not exist")
                url = AppKit.NSURL.fileURLWithPath_(path)
            _isPDF, pdfDocument = isPDF(url)
            # check if the file is an .eps
            _isEPS, epsRep = isEPS(url)
            # check if the file is an .gif
            _isGIF, gifRep = isGIF(url)
            if _isEPS:
                _isPDF = True
                rep = epsRep
            elif _isGIF and pageNumber is not None:
                rep = gifTools.gifFrameAtIndex(url, pageNumber - 1)
            elif _isPDF and pageNumber is not None:
                page = pdfDocument.pageAtIndex_(pageNumber - 1)
                # this is probably not the fastest method...
                rep = AppKit.NSImage.alloc().initWithData_(
                    page.dataRepresentation())
            else:
                rep = AppKit.NSImageRep.imageRepWithContentsOfURL_(url)
        if _isPDF:
            w, h = rep.size()
        elif _isGIF:
            w, h = rep.size()
        else:
            w, h = rep.pixelsWide(), rep.pixelsHigh()
        return w, h
    def imageSize(self, path, pageNumber=None):
        """
        Return the `width` and `height` of an image.

        .. showcode:: /../examples/imageSize.py
        """
        if isinstance(path, self._imageClass):
            path = path._nsImage()
        if isinstance(path, AppKit.NSImage):
            rep = path.TIFFRepresentation()
            _isPDF = False
        else:
            if isinstance(path, (str, unicode)):
                path = optimizePath(path)
            if path.startswith("http"):
                url = AppKit.NSURL.URLWithString_(path)
            else:
                if not os.path.exists(path):
                    raise DrawBotError("Image does not exist")
                url = AppKit.NSURL.fileURLWithPath_(path)
            _isPDF, pdfDocument = isPDF(url)
            # check if the file is an .eps
            _isEPS, epsRep = isEPS(url)
            # check if the file is an .gif
            _isGIF, gifRep = isGIF(url)
            if _isEPS:
                _isPDF = True
                rep = epsRep
            elif _isGIF and pageNumber is not None:
                rep = gifTools.gifFrameAtIndex(url, pageNumber-1)
            elif _isPDF and pageNumber is not None:
                page = pdfDocument.pageAtIndex_(pageNumber-1)
                # this is probably not the fastest method...
                rep = AppKit.NSImage.alloc().initWithData_(page.dataRepresentation())
            else:
                rep = AppKit.NSImageRep.imageRepWithContentsOfURL_(url)
        if _isPDF:
            w, h = rep.size()
        elif _isGIF:
            w, h = rep.size()
        else:
            w, h = rep.pixelsWide(), rep.pixelsHigh()
        return w, h