imagecreatetruecolor
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
imagecreatetruecolor — TrueColor イメージを新規に作成する
説明
imagecreatetruecolor
( int $width
, int $height
) : resource
imagecreatetruecolor() は、指定した大きさの黒い画像を表す画像 ID を返します。
パラメータ
width
- 画像の幅。
height
- 画像の高さ。
返り値
成功した場合に画像リソース ID、エラー時に false
を返します。
例
例1 新規 GD イメージストリームの作成およびイメージの出力
<?phpheader ('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);?>
上の例の出力は、 たとえば以下のようになります。