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

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -