no me hagas mucho caso, no lo he provado, pero por logica la cosa tendría que ser así:
Código PHP:
header ("Content-type: image/jpeg");
$string = "mi texto";
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
$img = "imagenes/imagen.jpg";
$im = imagecreatefromjpeg($img);
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, 0, 0, $string, $text_color);
imageJPEG ($im);
ImageDestroy($im);