|
@@ 2571-2576 (lines=6) @@
|
| 2568 |
|
} |
| 2569 |
|
|
| 2570 |
|
// scan through current truecolor image copy alpha channel to temp image as grayscale |
| 2571 |
|
for ($x = 0; $x < $this->thumbnail_width; $x++) { |
| 2572 |
|
for ($y = 0; $y < $this->thumbnail_height; $y++) { |
| 2573 |
|
$PixelColor = phpthumb_functions::GetPixelColor($this->gdimg_output, $x, $y); |
| 2574 |
|
imagesetpixel($img_alpha_mixdown_dither, $x, $y, $dither_color[($PixelColor['alpha'] * 2)]); |
| 2575 |
|
} |
| 2576 |
|
} |
| 2577 |
|
|
| 2578 |
|
// dither alpha channel grayscale version down to 2 colors |
| 2579 |
|
imagetruecolortopalette($img_alpha_mixdown_dither, true, 2); |
|
@@ 2589-2596 (lines=8) @@
|
| 2586 |
|
imagecolortransparent($this->gdimg_output, $TransparentColor); |
| 2587 |
|
|
| 2588 |
|
// scan through alpha channel image and note pixels with >50% transparency |
| 2589 |
|
for ($x = 0; $x < $this->thumbnail_width; $x++) { |
| 2590 |
|
for ($y = 0; $y < $this->thumbnail_height; $y++) { |
| 2591 |
|
$AlphaChannelPixel = phpthumb_functions::GetPixelColor($img_alpha_mixdown_dither, $x, $y); |
| 2592 |
|
if ($AlphaChannelPixel['red'] > 127) { |
| 2593 |
|
imagesetpixel($this->gdimg_output, $x, $y, $TransparentColor); |
| 2594 |
|
} |
| 2595 |
|
} |
| 2596 |
|
} |
| 2597 |
|
imagedestroy($img_alpha_mixdown_dither); |
| 2598 |
|
|
| 2599 |
|
$this->DebugMessage('AlphaChannelFlatten() set image to 255+1 colors with transparency for GIF output', __FILE__, __LINE__); |