<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Resize di un'immagine: sfondo non uniforme]]></title><description><![CDATA[<p dir="auto">Salve a tutti,<br />
sto cercando di effettuare il resize di un'immagine, ma ho il problema che lo sfondo dell'immagine non risulta completamente bianco, ma ha delle righe orizzontali di grigio chiaro.</p>
<p dir="auto">Questo il codice che utilizzo per il resize:</p>
<pre><code>function resize_image($img, $imagedata, $new_w, $new_h)
{
  global $use_truecolor, $use_resampling, $r, $g, $b;
  // Create a new, empty image based on settings:
  if (function_exists('imagecreatetruecolor') &amp;&amp; $use_truecolor &amp;&amp; ($imagedata[2] == 2 || $imagedata[2] == 3))
  {
	$tmp_img = imagecreatetruecolor($new_w, $new_h);
  }
  else
  {
	$tmp_img = imagecreate($new_w, $new_h);
  }

  $th_bg_color = imagecolorallocate($tmp_img, $r, $g, $b);

  imagefill($tmp_img, 0, 0, $th_bg_color);
  //imagecolortransparent($tmp_img, $th_bg_color);

  // Create the image to be scaled:
  if ($imagedata[2] == 2 &amp;&amp; function_exists('imagecreatefromjpeg'))
  {
	$src = imagecreatefromjpeg($img);
  }
  elseif ($imagedata[2] == 1 &amp;&amp; function_exists('imagecreatefromgif'))
  {
	$src = imagecreatefromgif($img);
  }
  elseif (($imagedata[2] == 3 || $imagedata[2] == 1) &amp;&amp; function_exists('imagecreatefrompng'))
  {
	$src = imagecreatefrompng($img);
  }
  else
  {
    return false;
  }

  // Scale the image based on settings:
  if (function_exists('imagecopyresampled') &amp;&amp; $use_resampling)
  {
	imagecopyresampled($tmp_img, $src, 0, 0, 0, 0, $new_w, $new_h, $imagedata[0], $imagedata[1]);
  }
else
  {
	imagecopyresized($tmp_img, $src, 0, 0, 0, 0, $new_w, $new_h, $imagedata[0], $imagedata[1]);
  }
  return $tmp_img;
}
</code></pre>
<p dir="auto">Sapete spiegarmi perchè ho questo problema?</p>
<p dir="auto">Grazie</p>
]]></description><link>https://dev.connect.gt/topic/38682/resize-di-un-immagine-sfondo-non-uniforme</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 17:41:01 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/38682.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jun 2007 13:25:10 GMT</pubDate><ttl>60</ttl></channel></rss>