Tuesday, November 26, 2013

Copy Machines Part 2: Now with More Gorillas

With great blogging comes great responsibility.  I must create content worth reading to make the web a little better than I found it.  So when I am informed by a darling reader in the comments that my copy machine emulation is flawed because I used a giraffe picture, I have no choice but to repeat the experiment with a gorilla picture, as suggested.


This is a mountain gorilla in Uganda.  The photo has a
resolution of 72x72ppi, the same as the giraffe photo. 


As suggested, my verticalstreaks error function has been modified to use prime numbers.

def verticalstreaks(img):
    px=img.load()
    width, height=img.size
    rand1=random.randrange(1,523)
    rand2=random.randrange(1,653)
    #print rand1, rand2
    for i in range(width):
     
        for j in range(height):
            h=5
            if j%rand1==0 and i%rand2==0 and i+h<width and j+h<height:
                for k in range(h):
                    px[i,j+k]=(0,0,0)
                    px[i+1,j+k]=(0,0,0)
                 
    return img        


Now for results.  I am just using this with errors that should be invisible to a casual copyist, because again, if you noticed problems you would try it again, right?

Copied 50 times. 


Copied 100 times.



Copied 250 times. 

Copied 500 times.
So there you have it.  

1 comment: