title: how to create a custom filter by passing a color code in fabric js
body: <p>I am trying to create a custom filter it should like accepting color code.</p>
  
  <p>Here is my code.</p>
  
  <p>It is working fine.</p>
  
  <pre><code>fabric.Image.fromURL('pug.jpg', function(img) {
    img.filters.push(
      new fabric.Image.filters.Sepia(),
      new fabric.Image.filters.Brightness({ brightness: 100 }));
  
    img.applyFilters(canvas.renderAll.bind(canvas));
    canvas.add(img);
  }); 
  </code></pre>
  
  <p>Now, i need to create a filter with specific color code.
  What i found is </p>
  
  <pre><code>fabric.Image.filters.Redify = fabric.util.createClass({
  
    type: 'Redify',
  
    applyTo: function(canvasEl) {
      var context = canvasEl.getContext('2d'),
          imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height),
          data = imageData.data;
  
      for (var i = 0, len = data.length; i &lt; len; i += 4) {
        data[i + 1] = 0;
        data[i + 2] = 0;
      }
  
      context.putImageData(imageData, 0, 0);
    }
  });
  
  fabric.Image.filters.Redify.fromObject = function(object) {
    return new fabric.Image.filters.Redify(object);
  };
  </code></pre>
  
  <p>I need explanation what for loop does...also please explain how can i pass color code.</p>