mazha's profileA New AgePhotosBlogListsMore Tools Help

Blog


    17/02/2006

    [PC_14] walk around

    又是一道图像题~ @.@
     
    页面图片是一个牛角面包,上面一圈螺旋线,主图下面还有一个小图片,100 * 100 像素的,下载下来发现居然是 10000 * 1 的一条像素带子.. -_-!
    源文件提示 remember: 100*100 = (100+99+99+98) + (...
    这个 100 * 100 就是 10000 么,先动手把它弄成 100 * 100 像素的图片,看到上边写了几个红字 'bit',赶紧试试,果然不对,"you took the wrong curve."
    curve ? .... 看来这个像素带子要拼成图片是有特殊路线的。又想到图片面包上的螺纹,看着提示中的 (100+99+99+98) ... 是了!从外向内卷进去形成的 100 * 100 图片~
    写代码的时候好一顿计算 ...
     

    [code]

     
     import Image
     import ImageDraw
     
     im = Image.open('wire.png')
     imout = Image.new('RGB', (100, 100), 255)
     s = []
     for i in range(0, 100, 2 ):
         s.append(( (100-i) , (100-i-1) , (100-i-1) , (100-i-2) ))
     
     cnt = 0
     for t in s:
         for x in range( t[0] ):
             p = im.getpixel( (cnt, 0) )
             cnt += 1
             imout.putpixel(( 50 - t[0]/2 + x, 50 - t[0]/2 ), p)
         for x in range( t[1] ):
             p = im.getpixel( (cnt, 0) )
             cnt += 1
             imout.putpixel(( 50 + t[0]/2 - 1, 50 - t[0]/2 + 1 + x ), p)
         for x in range( t[2] ):
             p = im.getpixel( (cnt, 0) )
             cnt += 1
             imout.putpixel(( 50 + t[0]/2 - 2 - x, 50 + t[0]/2 - 1), p)
         for x in range( t[3] ):
             p = im.getpixel( (cnt, 0) )
             cnt += 1
             imout.putpixel(( 50 - t[0]/2, 50 + t[0]/2 - 2 - x), p)
             
     imout.save('PC_14.png')
     

     
    查看输出的图片,一只可爱的波斯猫哈哈~~ 嗯,就 'cat' 了~~~
    输入 url 看到了那只猫的全身照,hehe,真伟岸,留言 “and its name is uzi. you'll hear from him later”,看来下关的 key word 就是 uzi 乐~~~
    YES!
     

    Comments (3)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    瑞 黄wrote:
    呵呵,又看到14题了。我也刚刚做完。看来我要常来看看了。
    #15ing
    6 July
    wrote:
    没看懂这个是什么语言……
    5 Mar.
    Picture of Anonymous
    (没有名字) wrote:
    非常仰慕mazha哥的说明文
    18 Feb.

    Trackbacks

    The trackback URL for this entry is:
    http://bg5hfc.spaces.live.com/blog/cns!E67CCF4FFB0BE86!1163.trak
    Weblogs that reference this entry
    • None