public function rotate($degrees, $background = 0xffffff, $alpha = 1.0)
{
$transparent = imagecolorallocatealpha($this->_image, $background >> 16 & 0xff, $background >> 8 & 0xff, $background & 0xff, $alpha * 127);
$image = imagerotate($this->_image, 360 - $degrees, $transparent, true);
imagealphablending($image, false);
imagesavealpha($image, true);
imagedestroy($this->_image);
$this->_image = $image;
$this->_width = imagesx($image);
$this->_height = imagesy($image);
return $this;
}