Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7992423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:33:33+00:00 2026-06-04T13:33:33+00:00

Objective: Apply CSS Filters to video using html5 and JavaScript. Contraints: The solution must

  • 0

Objective: Apply CSS Filters to video using html5 and JavaScript.

Contraints: The solution must be compatible with Internet Exporer 10 (for Windows 8). I am really making a Metro app.

So Far:
I have a <video> that I am pumping onto a <canvas>. I thought I would be able to apply CSS filters directly to this (e.g. invert or brightness) but it turns out those are not compatible with IE10.

Thoughts: I am hoping for a way to apply SVG filters to the canvas. Is this possible? Do I need to copy the <canvas> to an <image> and apply the filters to that? Alternatively, should there be a way to wrap the canvas in a <foreignObject>?

Thank you for all your help!

Here is some code for those interested:

filters.svg:

<?xml version="1.0" standalone="no"?>
<svg width="1" height="1" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <filter id="blur">
      <feGaussianBlur in="SourceGraphic" stdDeviation="2 3" />
    </filter>
  </defs>
</svg>

style.css:

.a {
    filter: url(filter.svg#blur);
    -ms-transform: matrix(-1, 0, 0, 1, 0, 0);
}

page.html:

<div class="itemtemplate" data-win-control="WinJS.Binding.Template">
            <canvas class="a" style="width: 180px;height:180px;margin-bottom: -5px;" data-win-bind="style.backgroundColor: bc; id: effectId" />
</div>

The Following Code Works, albeit very slowly, to accomplish my goal. Thank you, Anthony!

<html>
<head>

</head>
<body>
<svg id="svgroot"  viewbox="0 0 800 800" width="800" height="800"  preserveAspectRatio="xMidYMin">
    <defs>
<filter id="myHueRotate">
<feColorMatrix type="hueRotate" values="270"/>
</filter>
</defs>
<image id="a" filter="url(#myHueRotate)"  x="0" y="0" width="300" height="300" />
<image id="b" filter="url(#myHueRotate)"  x="300" y="0" width="300" height="300" />
<image id="c" filter="url(#myHueRotate)"  x="0" y="300" width="300" height="300" />
<image id="d" filter="url(#myHueRotate)"  x="300" y="300" width="300" height="300" />
</svg>
<canvas id="canvas" height="300" width="300"></canvas>
<video id="vid" src="movie.m4v" height="300" width="300" style="display: none" autoplay/>


<script>
  var ctx = document.getElementById('canvas').getContext('2d');
  var img = new Image();
  img.src = 'img.jpg';
  img.onload = function(){
    //ctx.drawImage(img,0,0);
    //var canvasImage = canvas.toDataURL("image/png");
    //var svgImage = document.getElementById('a');
    //svgImage.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", canvasImage);
    draw();
  }
img.load();

function draw(){
    var ctx = document.getElementById('canvas').getContext('2d');
    var vid = document.getElementById('vid')
    ctx.drawImage(vid,0,0,300,300);
    var canvasImage = canvas.toDataURL("image/png");
    document.getElementById('a').setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", canvasImage);
    document.getElementById('b').setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", canvasImage);
    document.getElementById('c').setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", canvasImage);
    document.getElementById('d').setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", canvasImage);
    setTimeout(draw,40);
}
</script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:33:35+00:00Added an answer on June 4, 2026 at 1:33 pm

    First, articles to read:

    moving-to-standards-based-web-graphics-in-ie10

    Notice specifically the sections:

    Use SVG, not VML

    and

    Use CSS3, not DX Filters

    In that second section, they mention:

    DX Filters are not the same as SVG Filter Effects, though both use the CSS property name filter.

    Second article:

    Introduction to Filters and Transitions

    They give a specific example of how to use invert, but, assuming it is the way in IE, I can see why it wasn’t easy to find and may or may not work in your case. But the css would be:

    #yourTargetElement {
         filter: DXImageTransform.Microsoft.BasicImage(invert=1);
    }
    

    They don’t mention brightness, but they do mention several other filters and transitions, and that first article does mention using SVG. More details (hopefully helpful ones) at:

    SVG Filter Effects in IE10

    This looks like part 1 of the key:

    A filter is applied to an SVG element via the filter attribute, in the form of filter=”url(#filterId)”, or it can be applied as a CSS property filter:url(#filterId)

    And this is part 2:

    There are 16 different filter primitives.

    Now, I believe the 16 they refer to are the full set for SVG, but knowing MS, it could also mean either:

    1. These are the 16 we support, or
    2. These are the 16 we’ve invented so as to continue our claim to make IE standards-compliant and SVG/MathML friendly, but making it harder than it would be in any other browser…because we can.

    Or, to quote Lily Tomlin: “We don’t care, we don’t have to…we’re the phone company.”

    But, assuming MS is finally realizing they need to catch up, reading further on the 16 primitive filters, supposedly you just have your embedded SVG, with the filters in the right place (defs) and call them via css. Here is one of their examples (slightly modified and simplified by me):

    HTML w/ Embedded SVG:

    <div id="svg_wrapper">
    <svg xmlns="http://www.w3.org/2000/svg" id="svgroot" viewBox="0 0 800 533" preserveAspectRatio="xMidYMin">
        <defs>
         <filter id="filtersPicture">
                 <feComposite operator="arithmetic" k1="0" k2="1" k3="0" k4="0" 
                   in="SourceGraphic" in2="SourceGraphic" result="inputTo_6">
                 </feComposite>      
                 <feColorMatrix type="saturate" id="filter_6" values="2" 
                                data-filterId="6">
                 </feColorMatrix>
                 </filter>
       </svg>
      </div>
    

    CSS (They use JS to make it dynamic, so beware):

    <style type="text/css">
         #yourTargetElement{
                 filter:url(#filtersPicture);
          }
     </style>
    

    The reason I caution on how “easy” they make it look is because they are adding the style via js and an interactive form (maybe you have the same thing in mind), but I imagine that runs the same risk as calling an element in a script before it is in the DOM, in that it can’t find the filter and throws an error. So be sure if you want to keep it simple (non-dynamic) and things still aren’t working, to try putting the filter/svg above the style (even if this causes a flicker).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any generally-accepted coding standards (naming, casting etc) that apply specifically to iPhone/Cocoa/Objective-C?
Objective: In support of a Windows Service that may have multiple instances on a
I am trying to apply the ASIHTTPRequest wrapper to a very basic Objective C
I'm learning Cocoa/Objective-C/iPhone SDK, and as a simple project to apply what I've learned,
I need to make tutorial for beginner using the R *apply function (without using
I'm creating a game in objective C using the cocos 2d engine for iPhone.
I'm making a Objective-C class that can apply lots of effects on images. I
There's a feature of the Apple Objective-C language which is really useful to me:
In Objective-C on Apple there is something called Key-Value Coding that allows you to
As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.