admin管理员组文章数量:1415664
This one is not trivial. I want to create a chroma key menu. For those not familiar, it is the same in video with the green background (or whatever color) being removed and special background is added.
I have images as a background in a menu. What I want is to set in someway the section where the background is transparent and the rest being filled with a color. In the example below, the background of the menu is image. Can we have such a background without one?
I am interested in unified solutions, not ones using css3.
This one is not trivial. I want to create a chroma key menu. For those not familiar, it is the same in video with the green background (or whatever color) being removed and special background is added.
I have images as a background in a menu. What I want is to set in someway the section where the background is transparent and the rest being filled with a color. In the example below, the background of the menu is image. Can we have such a background without one?
I am interested in unified solutions, not ones using css3.
Share Improve this question edited Sep 26, 2011 at 8:27 thirtydot 228k50 gold badges392 silver badges354 bronze badges asked Sep 26, 2011 at 6:43 OdysOdys 9,11011 gold badges75 silver badges116 bronze badges 3- If you can use JavaScript/jQuery, you really should have tagged your question as such. – thirtydot Commented Sep 26, 2011 at 8:27
- 1 I don't really understand what you're trying to achieve, but couldn't you just use PNGs with alpha-transparency? That's how I would implement what you have posted above; but like I say, I'm not sure if I fully grok the requirements! – Xophmeister Commented Sep 26, 2011 at 8:39
- To add: I think it, if it's possible, it would be very difficult (and very slow) to do chroma keying and posite effects a la the video world. – Xophmeister Commented Sep 26, 2011 at 8:41
2 Answers
Reset to default 3I'm happy to be proven wrong, but I'm fairly sure the answer is no, not even with CSS3. Maybe using IE's very advanced filter()
s but those aren't cross-browser.
Using a transparent channel for the background is the only way to go. It won't be trivial, but you could use a server-side script to change a specific colour into the transparent colour.
ImageMagick should be able to do this. Here's a promising example.
However, these examples are for replacing one colour. Whether it's possible to make this look good for anti-aliased edges (where the "transparent" colour blends into the surface colour, creating a mixture that the program would have to detect), I don't know.
If at all possible, use proper transparency from the start.
I imagine this would be possible on the client-side by copying the image into a <canvas>
rendering context, processing the image data (like ImageMagick does) then outputting a data uri which you can use as the CSS background-image of your menu.
For reference see:
http://www.hmp.is.it/creating-chroma-key-effect-html5-canvas/
http://www.html5canvastutorials./advanced/html5-canvas-get-image-data-url/
本文标签: javascriptCan we have quotChroma keyquot technique using plain CSS or jQueryStack Overflow
版权声明:本文标题:javascript - Can we have "Chroma key" technique using plain CSS or jQuery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745172276a2646048.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论