~ubuntu-branches/ubuntu/precise/python-imaging/precise-updates

« back to all changes in this revision

Viewing changes to PIL/ImageColor.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-11-20 19:22:59 UTC
  • mfrom: (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091120192259-cmnfui5tv2jtq4xu
Tags: 1.1.7-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# The Python Imaging Library
3
 
# $Id: ImageColor.py 2813 2006-10-07 10:11:35Z fredrik $
 
3
# $Id$
4
4
#
5
5
# map CSS3-style colour description strings to RGB
6
6
#
9
9
# 2002-12-15 fl   Added RGBA support
10
10
# 2004-03-27 fl   Fixed remaining int() problems for Python 1.5.2
11
11
# 2004-07-19 fl   Fixed gray/grey spelling issues
 
12
# 2009-03-05 fl   Fixed rounding error in grayscale calculation
12
13
#
13
14
# Copyright (c) 2002-2004 by Secret Labs AB
14
15
# Copyright (c) 2002-2004 by Fredrik Lundh
105
106
        return r, g, b, 255
106
107
    if Image.getmodebase(mode) == "L":
107
108
        r, g, b = color
108
 
        return r*299/1000 + g*587/1000 + b*114/1000
 
109
        return (r*299 + g*587 + b*114)/1000
109
110
    return color
110
111
 
111
112
colormap = {