19 declare(strict_types=1);
    33     private string $format = self::FORMAT_JPG;
    87         $clone->quality = $image_quality;
   103         $format = strtolower($format);
   104         if ($format === 
'jpeg') {
   105             $format = self::FORMAT_JPG;
   108         if (!in_array($format, $this->allowed_formats, 
true)) {
   109             throw new \InvalidArgumentException(
'Format must be one of ' . implode(
', ',$this->allowed_formats) . 
', but ' . $format . 
' was given.');
   116         if ($this->format === self::FORMAT_WEBP) {
   117             if ($image_quality !== 0 && $image_quality !== 100) {
   118                 throw new \InvalidArgumentException(
'WebP only supports quality 0 (loss) or 100 (losless)');
   120         } elseif ($image_quality < 0 || $image_quality > 100) {
   121             throw new \InvalidArgumentException(
'Quality must be between 0 and 100');
 withWebPOutput()
set the output format to WEBP 
 
withPngOutput()
set the output format to PNG 
 
withJpgOutput()
set the output format to JPG 
 
withQuality(int $image_quality)
set the image compression quality. 
 
withFormat(string $format)
set the desired output format. 
 
checkImageQuality(int $image_quality)
 
checkFormat(string $format)