I have an image I have to rotate that image 25 degree. if I rotate it shows some black background. How can I avoid that. How can I rotate image completely with out showing the black portion by using PHP GD. I cant use js for rotation. because I have to merge the image with another one after rotation. any body have the scripts for this please help me.
The black area is unavoidable on rotation - PHP (and GD for that matter) isn't Photoshop's content-aware-fill and won't generate more picture for you during the rotation to cover up the black bits.
You've got two choices:
do some math and figure out what size of rectangle you can slice out of the rotated image to eliminate the black borders (eg: the post-rotation image will be smaller than the original)
blow up the original image prior to rotating, such that after rotating, you can slice out a rectangular chunk that matches the original non-rotated size. Again, calls for a bit of math.
Of course, this all depends on just how you're rotating the image. Rotating on a corner will lead to vastly different results than rotating on the center of the image.