title: Removing colors from an image in python
body: <p>This code removes red but I can’t get it to work for removing other colors. </p>
  
  <pre class="lang-py prettyprint-override"><code>def removeRed(inLines, outfile):
      for i in range(3, len(lines)):
          line = lines[i]
          nums = line.split()
          outLine = ''
          for j in range(len(nums)):
              if j % 3 == 0:
                  outLine = outLine + '0 '
              else:
                  outLine = outLine + nums[j] + ' '
          outfile.write(outLine + '\n')
  </code></pre>