php - alpha number 0-255 equivalent in 0-127 range -


i have rgba color in alpha value in 0-255 range. using function imagecolorallocatealpha in php accept alpha value in 0-127 range.how can convert alpha value in 0-255 0-127

for example  alpha = 255 equivalent in 0-127 = 127  alpha = 0 equivelent in 0-127 = 0 

use code

imagecolorallocatealpha($image, $red, $green, $blue, $alpha/2); 

instead of

imagecolorallocatealpha($image, $red, $green, $blue, $alpha);  example  alpha = 255 equivalent in 0-127 = 127  (255/2 = 127.5)  alpha = 0 equivelent in 0-127 = 0   (0/2 = 0) 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -