לדלג לתוכן

קובץ:Arnold's Cat Map animation (74px, labelled).gif

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

Arnold's_Cat_Map_animation_(74px,_labelled).gif(76 × 100 פיקסלים, גודל הקובץ: 391 ק"ב, סוג MIME‏: image/gif, בלולאה, 117 תמונות, 47 שניות)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.
תיאור
English: Animation of Arnold's cat map (with iteration numbers), using an image of cherries as the starting image. The image is 74 pixels square, and repeats after 114 iterations. Notice how the image sometimes contains superimposed cherries, many tiny cherries or a single perfectly reproduced but upside-down image.
תאריך יצירה
מקור

נוצר על־ידי מעלה היצירה

Used File:Cherry Stella444.jpg as the starting image
יוצר Inductiveload
אישורים והיתרים
(שימוש חוזר בקובץ זה)
w:he:Creative Commons
ייחוס שיתוף זהה
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 3.0 לא מותאם.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
  • שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.
גרסאות אחרות

Python source code

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import Image #needs PIL for image handling
import ImageChops
import ImageFont
import ImageDraw

# checks if two images are equal
def equal(im1, im2):
    return ImageChops.difference(im1, im2).getbbox() is None

# add a text caption to an image (adds space at the bottom)
def addCaption(im, text, pointSize):
    size = im.size
    draw = ImageDraw.Draw(im)

    textFontLocation = "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
    topBottomMargin = 5
    
    textFont = ImageFont.truetype(textFontLocation ,pointSize)
    textSize = draw.textsize(text, font=textFont) # the size of the text box!
    
    newImage = Image.new(im.mode,\
            (im.size[0], im.size[1]+textSize[1]+2*topBottomMargin), "white" )
    newImage.paste( im, (0,0) )
    draw = ImageDraw.Draw(newImage)
    
    textX = (newImage.size[0] / 2.0) - (textSize[0] / 2.0)
    textY = newImage.size[1] - textSize[1] - topBottomMargin
    
    draw.text((textX, textY), text, fill="black", font=textFont)
    return newImage

# add a solid border to an image
def addBorder(im, color, thickness):
    newImage = Image.new(im.mode,\
            (im.size[0]+thickness*2, im.size[1]+thickness*2), color)
    newImage.paste( im, (1,1) )
    return newImage
    
# scale an image up or down (doesn't resample, so the pixels are clear)
def scaleImage(im, factor):
    newImage = Image.new(im.mode,\
            (im.size[0]*factor, im.size[1]*factor), "white" )
    newImage.paste( im.transform((im.size[0]*factor, im.size[1]*factor),\
            Image.AFFINE,\
            (1/float(factor),0,0,0,1/float(factor),0) ),\
            (0,0) )
    return newImage
    
def saveImages(im, iteration):
    im.save("Catmap%04d.png"%iteration) #save the simple image
    
    #resize image, add border and caption
    imageLarge = addBorder(im, "black", 1)
    imageLarge = addCaption(imageLarge, str(iteration), 12)
    imageLarge.save("CatmapLargeNumbered%04d.png"%iteration)

# CONTROL STARTS HERE

inFile = "aa-catmap-orig.resized.jpg" #input image

image0 = Image.open(inFile, 'r')

#crop to square if required
if image0.size[0] != image0.size[1]:
    n = min(image0.size[0], image0.size[1] )
    image0 = image0.crop((0,0,n,n))
else:
    n = image0.size[0]

imageOrig = image0.copy() # keep to original image to see when we return to it

image1 = Image.new(image0.mode, (n,n)) # temp image to copy pixels to
pixels1 = image1.load()

# BEGIN THE CAT MAPPING PROCESS

iteration = 0
saveImages(image0, iteration) # save the first image
while True:
    pixels0 = image0.load() #reload the iterated image
    
    for x in range(n):# perform the mapping
        for y in range(n):
            newX = (2*x + y) % n #find new location
            newY = (x + y) % n
            pixels1[newX, newY] = pixels0[x, y] # copy the pixel over
    
    image0 = image1.copy() #transfer back to image0 for the next iteration
    iteration += 1
    saveImages(image0, iteration) # save this iteration's image

    if equal(image0, imageOrig):
        break

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

פריטים שמוצגים בקובץ הזה

מוצג

checksum אנגלית

3180f10a5efa02163132213bb9232b5de9f2f6af

הוגדר לפי: SHA-1 אנגלית

399,933 בית

46.7999999999999 שנייה

100 פיקסל

76 פיקסל

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית22:23, 15 בספטמבר 2010תמונה ממוזערת לגרסה מ־22:23, 15 בספטמבר 2010‪100 × 76‬ (391 ק"ב)Inductiveload{{Information |Description={{en|Animation of en:Arnold's cat map (with iteration numbers), using an image of cherries as the starting image. The image is 74 pixels square, and repeats after 114 iterations. Notice how the image sometimes contains sup

אין בוויקיפדיה דפים המשתמשים בקובץ זה.