note 21168 added to function.imagesetpixel

From: Date: Wed, 01 May 2002 19:30:57 +0000
Subject: note 21168 added to function.imagesetpixel
Groups: php.notes 
Request: Send a blank email to php-notes+get-30059@lists.php.net to get a copy of this message
Create an PNG file from RAW use imagesetpixel --------------------------------------------- download "lena.raw" first http://gatekeeper.dec.com/pub/X11-contrib/wavelet_pic/lena.raw which is a 512*512 raw image file. <? $filename="lena.raw"; $width=512; $height=512; $fp=fopen($filename, "r"); $contents=fread($fp,filesize($filename)); fclose($fp); $contents=chunk_split("$contents",8,","); for ($i=0;$i<512;$i++){ for ($j=0;$j<512;$j++){ $img[$i][$j]=base_convert(bin2hex($contents[$i+$j]),16,10); } } $image=imagecreate($width,$height); for ($i=0;$i<512;$i++){ for ($j=0;$j<512;$j++){ imagesetpixel ($image,$i,$j,$color[$i][$j]); } } imagepng($image,"result.png"); imagedestroy($image); echo "<img src=result.png></img>"; ?> -- Ming Zhi Huang. - Taiwan -- http://www.php.net/manual/en/function.imagesetpixel.php http://master.php.net/manage/user-notes.php?action=edit+21168 http://master.php.net/manage/user-notes.php?action=delete+21168 http://master.php.net/manage/user-notes.php?action=reject+21168

« previous php.notes (#30059) next »