4

For some reason alpha channel in php gd is limited to 0-127 range, while it's supposed to be 0-255 for rgba.

Now, if we create a color with alpha greater than 127 (eg, using imagecolorallocatealpha) it would make a default black color instead...

I wonder if there is any alternative way to make pictures that would fully utilize the alpha channel. It's beyond my understanding why would gd truncate the alpha channel down to 7bits, and then again output a png with 8 bit/channel.

I would also consider outputting png pixel by pixel.

Anonymous
  • 4,692
  • 8
  • 61
  • 91
  • 1
    Have you tried ImageMagick? Also, have you tried `ceil($val / 2);` when defining the alpha channel? – WWW Jul 25 '12 at 19:31
  • Never heard of ImageMagick, I shall research about it. I understand I could divide the value to make it actually work, but it wouldn't help with truncation. – Anonymous Jul 25 '12 at 19:35

1 Answers1

0

You need to check Imagemagick. http://www.imagemagick.org/

As I understand GD is aimed at producing Graphs, then it was extended to include such image processing tasks. Imagemagick is also widely used for online image processing.

Mina Abadir
  • 2,951
  • 2
  • 15
  • 20