By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,776 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,776 IT Pros & Developers. It's quick & easy.

Pixelation Program... trying to pixelate an image in Jython

P: 3
Expand|Select|Wrap|Line Numbers
  1. def pixalated():
  2.   myFile = pickAFile()
  3.   myPicture=makePicture(myFile)
  4.   n=requestInteger("Please enter an (integer) for pixelation")
  5.   width = getWidth(myPicture)
  6.   height = getHeight(myPicture)
  7.   canvas = makeEmptyPicture(width,height)
  8.   for x in range(0,width,n):
  9.     red = 0
  10.     blue = 0
  11.     green = 0
  12.     for y in range(0,height,n):
  13.       red = getRed(myPicture)
  14.       blue = getBlue(myPicture)
  15.       green = getGreen(myPicture)
  16.     averagered = (red/(n*n))
  17.     averageblue = (blue/(n*n))
  18.     averagegreen = (green/(n*n))
  19.     red = averagered
  20.     blue =averageblue
  21.     green = averagegreen
  22.     newColor = makeColor(red, blue, green)
  23.     setColor(myPicture,newColor) 
  24.     y=y+1
  25.   x=x+1
  26.   show(canvas)
Apr 29 '13 #1
Share this Question
Share on Google+
4 Replies

bvdet
Expert Mod 2.5K+
P: 2,851
Do you have a problem with your code or a specific question?
Apr 29 '13 #2

P: 3
I have problem with my code
Apr 29 '13 #3

bvdet
Expert Mod 2.5K+
P: 2,851
And the problem is........

Seriously - What is your code supposed to accomplish? Does your code error when run? If so, please post the complete traceback.

I'm not familiar with Jython, so I'm at a disadvantage.
Apr 29 '13 #4

P: 3
the code supposed to open an image with pixelated effect. Yep the code has error when i load it .
Apr 30 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.