SMF Development > Fixed or Bogus Bugs
imagecreatefrombmp
(1/1)
Roger Garstang:
Was searching for this function online and found various versions. One claiming to support all the bits 1-32 didn't work at all, another one was really small and fast and only worked with 24bit+. Yours is nicely written and works with 4bits and up. I made you a 1bit/monochrome version if you want to support it, just add this to your section processing the bits and bytes of the image:
--- Code: ---elseif ($info['bits'] == 1)
{
$x = 0;
for ($j = 0; $j < $scan_line_size; $x++)
{
$byte = ord($scan_line{$j++});
imagesetpixel($dst_img, $x, $y, $palette[(($byte) & 128) != 0]);
for ($shift = 1; $shift < 8; $shift++) {
if (++$x < $info['width']) imagesetpixel($dst_img, $x, $y, $palette[(($byte << $shift) & 128) != 0]);
}
}
}
--- End code ---
emanuele:
Hello Roger,
thanks for your words and your code! (and welcome to sm.org! ;))
Trekkie101:
Couldn't find this in the 2.1 codebase, did you steal it yet Eman :P?
Spuds:
Its been added to Subs-Graphics.php so this can be closed
Navigation
[0] Message Index
Go to full version