public function setFormat($format)
    {
        if (!in_array($format, self::$formats)) {
            throw new ImageException('Invalid image format provided. Supported formats are [jpg, jpeg, png, gif].');
        }

        $this->format = $format;
    }