Skip to content

Commit

Permalink
刚刚发了文章描述EffectLab.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricporter committed Jul 15, 2012
1 parent 1136f40 commit 82ac4a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions TestEffectLab.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#

import os
from math import sqrt, sin, cos, tan, atan2
from EffectLab.Effect import *

def make_origin_and_new(img, effect):
def merge_origin_and_new(img, effect):
'''Merge origin and new Image processed by function effect in one Image
'''
width, height = img.size
Expand All @@ -20,7 +21,6 @@ def make_origin_and_new(img, effect):
out.paste(old, (0, 0))
out.paste(img, (width, 0))
draw = ImageDraw.Draw(out)

draw.line((width, 0, width, height), (255, 0, 0, 255))

return out
Expand All @@ -29,7 +29,7 @@ def make_origin_and_new(img, effect):
effects = [GlobalWaveEffect(),
RadianSqrtEffect(),
RadianFormulaEffect(lambda r, phi: (r ** 1.5 * math.cos(r), phi)),
LensWarpEffect(lambda x, y: (math.sin(x * math.pi / 2), math.sin(y * math.pi / 2))),
LensWarpEffect(lambda x, y: (sin(x * math.pi / 2), sin(y * math.pi / 2))),
LensWarpEffect(lambda x, y: (sign(x) * x ** 2, sign(y) * y ** 2)),
RadianFormulaEffect(lambda r, phi: (r ** 2, phi), 4),
LocalWarpEffect((130, 120), (130, 50), 100),
Expand All @@ -41,6 +41,6 @@ def make_origin_and_new(img, effect):
img = Image.new("RGBA", (300, 300), (255, 255, 255, 255))

for index, effect in enumerate(effects):
make_origin_and_new(img, effect).save('%d.jpg' % index, quality=90)
merge_origin_and_new(img, effect).save('%d.jpg' % index, quality=90)
print '.',
print 'done'

0 comments on commit 82ac4a2

Please sign in to comment.