note 79511 added to function.imagecolorsforindex

From: Date: Fri, 30 Nov 2007 20:45:12 +0000
Subject: note 79511 added to function.imagecolorsforindex
Groups: php.notes 
Request: Send a blank email to php-notes+get-132703@lists.php.net to get a copy of this message
The earlier microsoft sepia example seemed to have a factor in which made it pinky... here is a modified example which uses just the Microsoft sepia (as per the wiki sepia entry) <? function imagetosepia(&$img) { if (!($t = imagecolorstotal($img))) { $t = 256; imagetruecolortopalette($img, true, $t); } $total = imagecolorstotal( $img ); for ( $i = 0; $i < $total; $i++ ) { $index = imagecolorsforindex( $img, $i ); $red = ( $index["red"] * 0.393 + $index["green"] * 0.769 + $index["blue"] * 0.189 ); $green = ( $index["red"] * 0.349 + $index["green"] * 0.686 + $index["blue"] * 0.168 ); $blue = ( $index["red"] * 0.272 + $index["green"] * 0.534 + $index["blue"] * 0.131 ); if ($red > 255) { $red = 255; } if ($green > 255) { $green = 255; } if ($blue > 255) { $blue = 255; } imagecolorset( $img, $i, $red, $green, $blue ); } } ?> ---- Server IP: 194.145.210.4 Probable Submitter: 86.135.36.40 ---- Manual Page -- http://www.php.net/manual/en/function.imagecolorsforindex.php Edit -- https://master.php.net/note/edit/79511 Del: integrated -- https://master.php.net/note/delete/79511/integrated Del: useless -- https://master.php.net/note/delete/79511/useless Del: bad code -- https://master.php.net/note/delete/79511/bad+code Del: spam -- https://master.php.net/note/delete/79511/spam Del: non-english -- https://master.php.net/note/delete/79511/non-english Del: in docs -- https://master.php.net/note/delete/79511/in+docs Del: other reasons-- https://master.php.net/note/delete/79511 Reject -- https://master.php.net/note/reject/79511 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132703) next »