/static/light_hatched_style/png_over_color.py

https://bitbucket.org/cistrome/cistrome-harvard/ · Python · 17 lines · 9 code · 6 blank · 2 comment · 0 complexity · f430193e161696fe77e6c3bcbdad71c8 MD5 · raw file

  1. #!/usr/bin/env python
  2. import sys
  3. import Image
  4. import ImageColor
  5. assert sys.version_info[:2] >= ( 2, 4 )
  6. over = Image.open( sys.argv[1] )
  7. color = ImageColor.getrgb( sys.argv[2] )
  8. new = Image.new( 'RGBA', over.size, color )
  9. # 'Over' is passed twice since it has an alpha channel -- it is it's own mask
  10. new.paste( over, over )
  11. new.save( sys.argv[3] )