Fredrik Lundh is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

effbot / pil-2009-raclette http://effbot.org/zone/pil-index.htm

Work repository for PIL 1.1.7 and beyond. The "default" branch should be fairly solid, the other branches less so. For production use, see the pil-117 repository.

Clone this repository (size: 1.6 MB): HTTPS / SSH
hg clone https://bitbucket.org/effbot/pil-2009-raclette
hg clone ssh://hg@bitbucket.org/effbot/pil-2009-raclette

pil-2009-raclette / Tests / test_image_getextrema.py

from tester import *

from PIL import Image

def test_extrema():

    def extrema(mode):
        return lena(mode).getextrema()

    assert_equal(extrema("1"), (0, 255))
    assert_equal(extrema("L"), (40, 235))
    assert_equal(extrema("I"), (40, 235))
    assert_equal(extrema("F"), (40.0, 235.0))
    assert_equal(extrema("P"), (11, 218)) # fixed palette
    assert_equal(extrema("RGB"), ((61, 255), (26, 234), (44, 223)))
    assert_equal(extrema("RGBA"), ((61, 255), (26, 234), (44, 223), (255, 255)))
    assert_equal(extrema("CMYK"), ((0, 194), (21, 229), (32, 211), (0, 0)))