Skip to content

Commit

Permalink
scaled output
Browse files Browse the repository at this point in the history
  • Loading branch information
jennazee committed Oct 26, 2012
1 parent aa6d252 commit 45e2998
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions synesthesizer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python

from __future__ import division
import Image
import webcolors
from imagesimpler import ImageSimpler
Expand All @@ -8,6 +9,7 @@
from pygame import font, Surface
from pygame import image as PyImage


"""
** This module takes an image and replaces each pixel with a word that is associated with the color that pixel displays **
Concept: Natan Last
Expand All @@ -23,12 +25,6 @@ def synesthesize(self, image, colors=['red', 'orange', 'yellow', 'green', 'blue'
Inputs: Image to be adulterated, colors to be used
Outputs: Nothing really -- saves image to disk
"""
print 'Simplifying the Image'

iSimp = ImageSimpler()
img = iSimp.simplify(image, colors, 25)
pixor = img.load()
img.show()

#take the list of requested colors and get a "word palatte" for each word
associates = {}
Expand All @@ -41,12 +37,18 @@ def synesthesize(self, image, colors=['red', 'orange', 'yellow', 'green', 'blue'
storage = copy.deepcopy(associates)

#to be the word representation of the image
textsize = 12
textsize = 14

font.init()
texter = font.SysFont('couriernew', textsize)
texter = font.SysFont('corbel', textsize)

(letWidth, letHeight) = texter.size('A')
(letWidth, letHeight) = texter.size('a')

print 'Simplifying the Image'
iSimp = ImageSimpler()
preimg = iSimp.simplify(image, colors, 25)
img = preimg.resize((preimg.size[0], int(preimg.size[1]*(letWidth/letHeight))))
pixor = img.load()

newH = img.size[1]*letHeight
newW = img.size[0]*letWidth
Expand Down

0 comments on commit 45e2998

Please sign in to comment.