def select(self, size): ''' Selects image of given size if multiple image are available in container. size - A tuple containing the size of the scaled image. returns True on success.''' width, height = size api.MagickResetIterator(self._wand) loop = True while loop: _width = api.MagickGetImageWidth(self._wand) _height = api.MagickGetImageHeight(self._wand) if _width == width and _height == height: return True loop = api.MagickNextImage(self._wand) api.MagickResetIterator(self._wand) return False
def _get_size(self): width = api.MagickGetImageWidth(self._wand) height = api.MagickGetImageHeight(self._wand) return (width, height)