Changeset 1891 for www


Ignore:
Timestamp:
Nov 6, 2007, 12:09:05 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Cosmetic change: renamed "image" to "Image".
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/study/study.py

    r1889 r1891  
    22
    33# Tiny image class to make examples short and readable
    4 from gd import image
    5 class image(image):
     4import gd
     5class Image(gd.image):
    66    def getGray(self, x, y):
    77        c = self.getPixel((x, y))
     
    1414
    1515# Load the 256x256 grayscale Lenna image
    16 src = image("lenna256bw.png")
     16src = Image("lenna256bw.png")
    1717(w, h) = src.size()
    1818
    1919# Test 1: 50% threshold
    20 dest = image((w, h))
     20dest = Image((w, h))
    2121for y in range(h):
    2222    for x in range(w):
     
    2626
    2727# Test 2: 40% threshold
    28 dest = image((w, h))
     28dest = Image((w, h))
    2929for y in range(h):
    3030    for x in range(w):
     
    3434
    3535# Test 3: 60% threshold
    36 dest = image((w, h))
     36dest = Image((w, h))
    3737for y in range(h):
    3838    for x in range(w):
     
    4242
    4343# Create a 50% halftone pattern with various block sizes
    44 dest = image((512, 128))
     44dest = Image((512, 128))
    4545for x in range(512):
    4646    d = 8 >> (x / 128)
     
    5151
    5252# Test 4: 33/66% threshold with 50% halftone pattern inbetween:
    53 dest = image((w, h))
     53dest = Image((w, h))
    5454for y in range(h):
    5555    for x in range(w):
     
    6565
    6666# Create 25% and 75% halftone patterns with various block sizes
    67 dest = image((512, 128))
     67dest = Image((512, 128))
    6868for x in range(512):
    6969    d = 8 >> (x / 128)
     
    7777
    7878# Test 4: 20/40/60/80% threshold with 25/50/75% halftone patterns inbetween:
    79 dest = image((w, h))
     79dest = Image((w, h))
    8080for y in range(h):
    8181    for x in range(w):
Note: See TracChangeset for help on using the changeset viewer.