tags:

views:

319

answers:

1

Hello,

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

Regards,
Pentium10

+5  A: 

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
actually just tied and #00414141 doesn't display, it might be invalid
Pentium10
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
@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
See http://php.net/manual/en/function.imagecolorallocatealpha.php for the 0-127 alpha range.
Alix Axel