Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image,ImageColor
- import math, cmath
- def compact(x,y):
- return int(50-50*math.exp(-4*(math.pow(x,2)+math.pow(y,2))))
- def deg(x):
- return int(math.degrees(x)+180)
- def Color(x,y):
- return ImageColor.getrgb("hsl("+str(deg(math.atan2(y,x)))+",100%,"+str(compact(x,y))+"%)")
- def Transform(x,y):
- Z=cmath.sin(z)
- return Color(Z.real,Z.imag)
- A=500
- B=500
- I_min=-2*math.pi
- I_max=2*math.pi
- R_min=-2*math.pi
- R_max=2*math.pi
- def main():
- size = width, hieght = A,B;
- im=Image.new("RGB",size)
- for x in range(A):
- for y in range(B):
- im.putpixel((x,y),Transform(complex((x-A/2)/(A/2)*(R_max-R_min)/2,(y-B/2)/(B/2)*(I_max-I_min)/2)))
- im.show()
- im.save("test.png")
- del im
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement