public function thumbnail(array $options = []) {
		if (empty($options['height']) || empty($options['width'])) {
			throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!'));
		}

		$mode = ImageInterface::THUMBNAIL_INSET;
		if (isset($options['mode']) && $options['mode'] === 'outbound') {
			$mode = ImageInterface::THUMBNAIL_OUTBOUND;
		}

		$filter = ImageInterface::FILTER_UNDEFINED;
		if (isset($options['filter'])) {
			$filter = $options['filter'];
		}

		$size = new Box($options['width'], $options['height']);
		$imageSize = $this->_image->getSize();
		$ratios = array(
			$size->getWidth() / $imageSize->getWidth(),
			$size->getHeight() / $imageSize->getHeight()
		);

		// if target width is larger than image width
		// AND target height is longer than image height
		if ($size->contains($imageSize)) {
			return $this->_image;
		}
		if ($mode === ImageInterface::THUMBNAIL_INSET) {
			$ratio = min($ratios);
		} else {
			$ratio = max($ratios);
		}
		if ($mode === ImageInterface::THUMBNAIL_OUTBOUND) {
			if (!$imageSize->contains($size)) {
				$size = new Box(
					min($imageSize->getWidth(), $size->getWidth()),
					min($imageSize->getHeight(), $size->getHeight())
				);
			} else {
				$imageSize = $this->_image->getSize()->scale($ratio);
				$this->_image->resize($imageSize, $filter);
			}
			$this->_image->crop(new Point(
				max(0, round(($imageSize->getWidth() - $size->getWidth()) / 2)),
				max(0, round(($imageSize->getHeight() - $size->getHeight()) / 2))
			), $size);
		} else {
			if (!$imageSize->contains($size)) {
				$imageSize = $imageSize->scale($ratio);
				$this->_image->resize($imageSize, $filter);
			} else {
				$imageSize = $this->_image->getSize()->scale($ratio);
				$this->_image->resize($imageSize, $filter);
			}
		}

		return $this;
	}