Skip to content
Advertisement

Can RGB and RGBA be converted to each other?

I have a RGB image, and I want to convert it to RGBA to get alpha channels. It’s likely to convert RGB to HSV to get V channel. but now i want to get Alpha channel from RGBA. Can RGB and RGBA be converted to each other?

Advertisement

Answer

RGB represented in RBGA is just the same RGB values with A=max. For example, in CSS colors, rgb(123,45,67) = rgba(123,45,67,1) since the maximum alpha is 1.

However, RGBA cannot be directly converted back to RGB (except when everything is with A=max). The actual colour displayed depends on what is behind it (i.e. the background).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement