public function save(File $file = null, $options = [])
    {
        if ($this->isNull($file)) {
            if ($this->isNull($this->destination)) {
                throw new ImageException('Unable to save the image. Destination storage is not defined.');
            }

            $file = $this->destination;
        }

        // extract the type
        try {
            $format = $this->str($file->getKey())->explode('.')->last()->caseLower()->val();
            $this->setFormat($format);
        } catch (ImageException $e) {
            throw $e;
        }

        // check quality parameter
        $options['quality'] = isset($options['Quality']) ? $options['Quality'] : Image::getConfig()->get('Quality', 90);

        return $file->setContents($this->getBinary($options));
    }