- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/File/Image/Imagick.php
- Класс: BitrixMainFileImageImagick
- Вызов: Imagick::save
public function save($file, $quality = 95, $format = null)
{
if ($this->image === null)
{
return false;
}
$prefix = "";
if ($format !== null)
{
$format = static::convertFormat($format);
if($format !== null)
{
$prefix = "{$format}:";
}
}
$this->image->setImageCompressionQuality($quality);
if ($format === "gif" || ($format = $this->image->getImageFormat()) === "GIF" || $format === "GIF87")
{
//strange artefacts with transparency - we limit the palette to 255 colors to fix it
$this->image->quantizeImage(255, Imagick::COLORSPACE_SRGB, 0, false, false);
}
if ($this->animated)
{
return $this->image->deconstructImages()->writeImages($prefix.$file, true);
}
else
{
return $this->image->writeImage($prefix.$file);
}
}