--- class.t3lib_stdgraphic.php.orig 2005-04-07 13:38:53.000000000 +0200 +++ class.t3lib_stdgraphic.php 2005-04-07 15:44:03.552021800 +0200 @@ -164,7 +164,7 @@ 'jpg' => '', 'jpeg' => '', 'gif' => '-colors 64', - 'png' => '-colors 64' + 'png' => '-colors 65536' ); var $NO_IMAGE_MAGICK = ''; var $V5_EFFECTS = 0; @@ -492,7 +498,8 @@ imagecopyresized($im_base, $im, 0,0,0,0, imagesx($im),imagesy($im),imagesx($im),imagesy($im)); // Copy the source image onto that imagecopyresized($im_base, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h); // Then copy the $cpImg onto that (the actual operation!) $im = $im_base; // Set pointer - $this->makeEffect($im, Array('value'=>'colors=256')); // Reduce colors to 256 - make SURE that IM is working then! + // Masi: is it safe to reduce to that many colours? + $this->makeEffect($im, Array('value'=>'colors=65536')); // Reduce colors to 256 - make SURE that IM is working then! } else { imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h); } @@ -553,7 +560,9 @@ // NiceText is calculated if (!$conf['niceText']) { // Font Color is reserved: - $this->reduceColors($im,256, 200); + if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') { + $this->reduceColors($im,256, 200); + } $Fcolor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]); // antiAliasing is setup: $Fcolor = ($conf['antiAlias']) ? $Fcolor : -$Fcolor; @@ -1378,7 +1402,9 @@ $conf['offset']=$cords[0].','.$cords[1]; $cords = $this->objPosition($conf,$workArea,Array($cords[2],$cords[3])); $cols=$this->convertColor($conf['color']); - $this->reduceColors($im,256, 255); + if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') { + $this->reduceColors($im,256, 255); + } $tmpColor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]); imagefilledrectangle($im, $cords[0], $cords[1], $cords[0]+$cords[2]-1, $cords[1]+$cords[3]-1, $tmpColor); } @@ -1469,7 +1495,7 @@ $commands.=' -flop'; break; case 'colors': - $commands.=' -colors '.t3lib_div::intInRange($value,2,255); + $commands.=' -colors '.t3lib_div::intInRange($value,2,65535); break; case 'shear': $commands.=' -shear '.t3lib_div::intInRange($value,-90,90); @@ -2542,7 +2575,10 @@ if ($this->ImageGif($this->im, $file)) { // ImageMagick operations if($this->setup['reduceColors']) { - $this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255)); + if ($ext == 'gif') + $this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255)); + else + $this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,65535)); t3lib_div::gif_compress($file,''); // Compress with IM (lzw) or GD (rle) (Workaround for the absence of lzw-compression in GD) } else { t3lib_div::gif_compress($file, 'IM'); // Compress with IM! (adds extra compression, LZW from ImageMagick) (Workaround for the absence of lzw-compression in GD)