title: Fabric JS Filters
body: <p>I've been working on filters for fabric JS and have created my own which seemed to work great. </p>
  
  <p>I followed this example and its worked fine in the past.
  <a href="http://fabricjs.com/image-filters/" rel="nofollow">http://fabricjs.com/image-filters/</a></p>
  
  <p>But for some reason now it throws an error.</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: f is not defined</p>
  </blockquote>
  
  <pre><code> var canvas = this.__canvas = new fabric.Canvas('c',
                              {
                                  isDrawingMode: false
                              }),
                              f = fabric.Image.filters;
  
  
  
  $('ul.swatches li').click(function (event)
  {
       color = this.getAttribute("data-color");
       var dataState = this.getAttribute("data-state");
       applyFilter(2, true &amp;&amp; new f.RemoveColor({
              threshold: 190,
              color: color
       }));
    });
  
  function applyFilter(index, filter)
  {
      var obj = canvas.item(0);
      obj.filters[index] = filter;
      obj.applyFilters(canvas.renderAll.bind(canvas));
  }
  </code></pre>