Pythonchallenge Level 14 (python2.7)

1. 100*100=(100+99+99+98)+(98+97+97+96)+...
2. the size of this image is 10000*1
3. the bread image tells some operation about rotation...
my thought is to draw the final image based on coordinateaxis
the implementation code:

>>> import Image
>>> image=Image.open('wire.png')
>>> temp=[]
>>> for i in range(100,0,-2):
temp.append([i,i-1,i-1,i-2])
>>> i=0
>>> j=0
>>> s=0
>>> region=Image.new(image.mode,(100,99))
>>> for p in temp:
box=(s,0,s+p[0],1)
region.paste(image.crop(box),(i,j,i+p[0],j+1))
box=(s+p[0],0,s+p[0]+p[1],1)
region.paste(image.crop(box).transpose(Image.ROTATE_270),(i+p[0],j,i+p[0]+1,j+p[1]))
box=(s+p[0]+p[1],0,s+p[0]+p[1]+p[2],1)
region.paste(image.crop(box).transpose(Image.ROTATE_180),(i+1,j+p[1],i+1+p[2],j+p[1]+1))
box=(s+p[0]+p[1]+p[2],0,s+sum(p),1)
region.paste(image.crop(box).transpose(Image.ROTATE_90),(i+1,j+1,i+2,j+p[1]))
s=s+sum(p)
i=i+1
j=j+1
region.save('region.png')

the result image is:, then go the the cat.html. now you would find that answer is uzi.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值