for ($j = 0; $j < $y_i; $j++) { $transp = true; for ($i = 0; $i < $x_i && $transp; $i++) { if ($align == "right") $rgb = ImageColorAt($im_n, $i+1, $j); else $rgb = ImageColorAt($im_n, ($x_i - $i)-1, $j); $a = ($rgb >> 24) & 0xFF; if ($a > 125) $larg[$j] ++; else $transp = false; } }