$image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_heig
You can define any type image:
// Save the image as 'simpletext.jpg' imagejpeg($im, 'path/to/your/image.jpg'); // or another image imagepng($im, 'path/to/your/image.png');
See examples here http://php.net/manual/en/function.imagecopyresampled.php