alpha

HTML5 Canvas Make Black Transparent

喜欢而已 提交于 2019-12-04 13:58:04
I have a large amount of images with a black background, here is one for example: Is it possible through Javascript to have to ignore the black (#000000) and have it draw on canvas? to appear like this? Basically trying to take the black pixels and make it an alpha channel. ericjbasti So you'll need to run through all the pixels and change the alpha value of all the black pixels. https://jsfiddle.net/0kuph15a/2/ This code creates a buffer (empty canvas) to draw the original image to. Once thats done, it takes all the pixels of this buffer canvas and then iterates over all the pixels and checks

Why do browsers render rgba differently on OSX?

走远了吗. 提交于 2019-12-04 13:37:05
问题 I was trying to code up some color manipulation code and was stuck for a long time with alpha, then I (2 hours later) realized browsers render rgba differently. I created this test: http://jsbin.com/adekez/2/ add /edit to look at the code Here are the results in 4 browsers in OSX Lion: http://imgur.com/g2iqu That is an element with a background of rgba(0,0,0,0.5) on top of white. My hex calculator says: FF÷2 = 7F.8 which means Safari at #808080 is correct Firefox at #7F7F7F is off by 1 Opera