5

What value would have #414141 as #AARRGGBB and what about #52b531? How can I convert this using PHP?

Regards,
Pentium10

Pentium10
  • 204,586
  • 122
  • 423
  • 502

1 Answers1

17

AA is the Alpha channel, and a straight conversion would be to set AA to FF to make it full opaque:

#414141 becomes #FF414141 

(Just to add: In some implementations it means the amount of Transparency where 00 means complete opaque and FF means fully transparent. In that case, #00414141 would be correct. But I think that is the exception)

Michael Stum
  • 177,530
  • 117
  • 400
  • 535
  • actually just tied and #00414141 doesn't display, it might be invalid – Pentium10 Feb 04 '10 at 22:08
  • I've always seen 0 alpha to be completely opaque. Also, doesn't the alpha value range from 0 to 127? 0xFF is 255. – Alix Axel Feb 04 '10 at 22:12
  • @Alix depends on the tool. I have never seen a range from 0 to 127 though, where I used it (ImageMagick in PHP or GDI+ in .net) it was always 0 to 255, or in DirectX Development I sometimes saw a floating point range between 0.0 and 1.0. And as said, I saw implementations where 0 meant "fully opaque" and I saw some where 0 meant "fully transparent"... But if RGB ranges from 0 to 255 each, A usually follows. – Michael Stum Feb 04 '10 at 22:39
  • See http://php.net/manual/en/function.imagecolorallocatealpha.php for the 0-127 alpha range. – Alix Axel Feb 05 '10 at 02:03