Index: t3lib/class.t3lib_stdgraphic.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_stdgraphic.php,v
retrieving revision 1.28
diff -u -r1.28 class.t3lib_stdgraphic.php
--- t3lib/class.t3lib_stdgraphic.php	1 May 2005 17:50:45 -0000	1.28
+++ t3lib/class.t3lib_stdgraphic.php	19 May 2005 21:53:30 -0000
@@ -163,7 +163,7 @@
 		'jpg' => '',
 		'jpeg' => '',
 		'gif' => '-colors 64',
-		'png' => '-colors 64'
+		'png' => '-colors 65536'
 	);
 	var $NO_IMAGE_MAGICK = '';
 	var $V5_EFFECTS = 0;
@@ -337,7 +337,7 @@
 				$theMask2 = $tmpStr.'_mask2.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
 						// prepare overlay image
 				$cpImg = $this->imageCreateFromFile($BBimage[3]);
-				$destImg = imagecreate($w,$h);
+				$destImg = $this->imagecreate($w,$h);
 				ImageColorAllocate($destImg, 0,0,0);
 				$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
 				$this->ImageGif($destImg, $theImage);
@@ -345,7 +345,7 @@
 				imageDestroy($destImg);
 						// prepare mask image
 				$cpImg = $this->imageCreateFromFile($BBmask[3]);
-				$destImg = imagecreate($w,$h);
+				$destImg = $this->imagecreate($w,$h);
 				ImageColorAllocate($destImg, 0,0,0);
 				$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
 				$this->ImageGif($destImg, $theMask);
@@ -490,7 +490,7 @@
 			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!
+			$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);
 		}
@@ -551,7 +551,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;
@@ -578,7 +580,7 @@
 				$newH = ceil($sF*imagesy($im));
 
 					// Make mask
-				$maskImg = imagecreate($newW, $newH);
+				$maskImg = $this->imagecreate($newW, $newH);
 				ImageColorAllocate($maskImg, 255,255,255);
 				$Fcolor = ImageColorAllocate($maskImg, 0,0,0);
 				if ($spacing || $wordSpacing)	{		// If any kind of spacing applys, we use this function:
@@ -613,7 +615,7 @@
 				$this->imageMagickExec($fileMask,$fileMask,$command);
 
 					// Make the color-file
-				$colorImg = imagecreate($w,$h);
+				$colorImg = $this->imagecreate($w,$h);
 				ImageColorAllocate($colorImg, $cols[0],$cols[1],$cols[2]);
 				$this->ImageGif($colorImg, $fileColor);
 				ImageDestroy($colorImg);
@@ -1258,14 +1260,14 @@
 			$fileMask = $tmpStr.'_mask.'.$this->gifExtension;
 
 				// BlurColor Image laves
-			$blurColImg = imagecreate($w,$h);
+			$blurColImg = $this->imagecreate($w,$h);
 			$bcols=$this->convertColor($conf['color']);
 			ImageColorAllocate($blurColImg, $bcols[0],$bcols[1],$bcols[2]);
 			$this->ImageGif($blurColImg, $fileColor);
 			ImageDestroy($blurColImg);
 
 				// The mask is made: BlurTextImage
-			$blurTextImg = imagecreate($w+$blurBorder*2,$h+$blurBorder*2);
+			$blurTextImg = $this->imagecreate($w+$blurBorder*2,$h+$blurBorder*2);
 			ImageColorAllocate($blurTextImg, 0,0,0);		// black background
 			$txtConf['fontColor'] = 'white';
 			$blurBordArr = Array($blurBorder,$blurBorder);
@@ -1295,7 +1297,7 @@
 			if ($blurTextImg_tmp)	{	// if nothing went wrong we continue with the blurred mask
 
 					// cropping the border from the mask
-				$blurTextImg = imagecreate($w,$h);
+				$blurTextImg = $this->imagecreate($w,$h);
 				$this->imagecopyresized($blurTextImg, $blurTextImg_tmp, 0, 0, $blurBorder, $blurBorder, $w, $h, $w, $h);
 				ImageDestroy($blurTextImg_tmp);	// Destroy the temporary mask
 
@@ -1376,7 +1378,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);
 	}
@@ -1467,7 +1471,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);
@@ -1526,7 +1530,7 @@
 		$conf['offset']=$cords[0].','.$cords[1];
 		$cords = $this->objPosition($conf,$this->workArea,Array($cords[2],$cords[3]));
 
-		$newIm = imagecreate($cords[2],$cords[3]);
+		$newIm = $this->imagecreate($cords[2],$cords[3]);
 		$cols=$this->convertColor($conf['backColor']?$conf['backColor']:$this->setup['backColor']);
 		ImageColorAllocate($newIm, $cols[0],$cols[1],$cols[2]);
 
@@ -1724,7 +1728,20 @@
 	}
 
 
-
+	/**
+	 * switch between imagecreatetruecolor und imagecreate based on GD version
+	 *
+	 * @param integer		X dimensions
+	 * @param integer		Y dimensions
+	 * @return resource	newly created mage resource
+	 */
+	function imagecreate($x, $y) {
+		if($this->GD2) {
+			return imagecreatetruecolor($x, $y);
+		} else {
+			return imagecreate($x, $y);
+		}
+	}
 
 
 
@@ -2540,7 +2557,11 @@
 					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)
@@ -2640,7 +2661,7 @@
 
 		// If non of the above:
 		$i = @getimagesize($sourceImg);
-		$im = imagecreate($i[0],$i[1]);
+		$im = $this->imagecreate($i[0],$i[1]);
 		ImageColorAllocate($im, 128,128,128);
 		return $im;
 	}
Index: tslib/class.tslib_gifbuilder.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/cms/tslib/class.tslib_gifbuilder.php,v
retrieving revision 1.13
diff -u -r1.13 class.tslib_gifbuilder.php
--- tslib/class.tslib_gifbuilder.php	13 Apr 2005 23:12:02 -0000	1.13
+++ tslib/class.tslib_gifbuilder.php	19 May 2005 21:53:32 -0000
@@ -344,7 +344,7 @@
 		$XY = $this->XY;
 
 			// Gif-start
-		$this->im = imagecreate($XY[0],$XY[1]);
+		$this->im = $this->imagecreate($XY[0],$XY[1]);
 		$this->w = $XY[0];
 		$this->h = $XY[1];
 
