Hour 1

Still playing around with Aviary.  I found the basic interface tutorial for Peacock (the hub based visual laboratory).  Somehow I managed to overlook it before.  I also looked over a basic tutorial for Raven, which is the vector graphics editor.  It was posted by this guy who must be one of the designers for the site.  And in preparation for my Interactive Presentation I thoughtfully downloaded this video.  Just hoping the college has RealPlayer installed.  Finally I tried out a nice Aviary browser plug-in for Firefox called Talon.  I may never need to use Photoshop again.

Hour 2 – 3

I need some images to use for the chess program I’m working on in Python.  So I found a set of chess pieces on line and imported them into Aviary.  After selecting each image and cropping out the remainder of the file, I desaturated to convert the images to grey scale, thus reducing the file size, and modified the brightness by 10, and the contrast by 5.  Hopefully this will make the pieces easier to read against the board.

I finally figured out how to import image files into Python using the graphics library created by John Zelle.  The first step is to set a variable to a pixmap of the file, then set another variable to an image of the pixmap like so:

from graphics import *
def main():
    win = GraphWin(“Test”, 500, 500)
    win.setBackground(‘peachpuff’)
    pawnFile = Pixmap(“images/pawn.gif”)
    pawn = Image(Point(250,250),pawnFile)
    print (type(pawn))
    pawn.draw(win)
    wait = win.getMouse()
main()

from graphics import *

def main():

    win = GraphWin(“Test”, 500, 500)

    pawnFile = Pixmap(“images/pawn.gif”)

    pawn = Image(Point(250,250),pawnFile)

    pawn.draw(win)

    wait = win.getMouse()

main()

Surprisingly transparency in a gif is maintained with in a Python graphics window.  Unfortunately the export image function on Aviary for gifs is not quite up to par.  I don’t know if it’s because the web safe colors option is set as a default, or if it’s an issue with transparency.

So giving up on Aviary for the moment, I pulled the chess set image into Photoshop, and it took about ten minutes to pull all the pieces out, delete the background, crop and save the files as gifs.  The same process took about a half an hour with Aviary because it can’t handle multiple images in the same window.

There is a drawback to importing images of the pieces into Python.  When I created the simple piece objects I did it based on a coordinate grid, so the images were drawn from the lower left corner.  With the imported images the center point is 0,0 so they are drawn on the corners of the squares.  I’ll need a fix for that.

Post a Comment

*
*