note 87601 added to function.imagecreate
| From: | gpanz dot blogspot dot com at osu1 dot php dot net | Date: | Fri, 12 Dec 2008 15:02:50 +0000 |
| Subject: | note 87601 added to function.imagecreate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148075@lists.php.net to get a copy of this message | ||
function ImageCreateFromBMP($filename)
16 bit images do not have a palette...
use this :
$PALETTE = array();
if ($BMP['colors'] < 16777216 && $BMP['colors'] != 65536)
{
$PALETTE = unpack('V'.$BMP['colors'], fread($f1,$BMP['colors']*4));
#nei file a 16bit manca la palette,
}
another fix:
elseif ($BMP['bits_per_pixel'] == 16)
{
$COLOR = unpack("v",substr($IMG,$P,2));
$blue = (($COLOR[1] & 0x001f) << 3) + 7;
$green = (($COLOR[1] & 0x03e0) >> 2) + 7;
$red = (($COLOR[1] & 0xfc00) >> 7) + 7;
$COLOR[1] = $red * 65536 + $green * 256 + $blue;
}
----
Server IP: 80.241.173.254
Probable Submitter: 87.238.17.212
----
Manual Page -- http://www.php.net/manual/en/function.imagecreate.php
Edit -- https://master.php.net/note/edit/87601
Del: integrated -- https://master.php.net/note/delete/87601/integrated
Del: useless -- https://master.php.net/note/delete/87601/useless
Del: bad code -- https://master.php.net/note/delete/87601/bad+code
Del: spam -- https://master.php.net/note/delete/87601/spam
Del: non-english -- https://master.php.net/note/delete/87601/non-english
Del: in docs -- https://master.php.net/note/delete/87601/in+docs
Del: other reasons-- https://master.php.net/note/delete/87601
Reject -- https://master.php.net/note/reject/87601
Search -- https://master.php.net/manage/user-notes.php