Your code is working fine. All you need is to add an "exit" at the end.
Code:
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
exit;
EDIT:
The main problem is that you are trying to change the response header into the view. You need to change it on the controller function that call the view. For example:
return \Response::view('myView')->header('Content-Type', 'image/png');
And then, in your PHP code all you need to do is remove the first line:
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);