1 Replies - 853 Views - Last Post: 28 November 2011 - 03:13 AM Rate Topic: -----

#1 mrtjbigs  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-November 11

Whats wrong with my scale down code?

Posted 27 November 2011 - 07:45 PM

So, i wrote this program that will scale down the size of an image by half. The logic seems in place(to me at least) but i keep receiving the error
"getPixel(picture,x,y): y (= 450) is less than 0 or bigger than the height (= 449)
The error was:
Inappropriate argument value (of correct type).
An error occurred attempting to pass an argument to a function.
Please check line 82 of C:\Users\owner\extra"

I'm not sure what is wrong with the code. I'm assuming its a syntax error, or perhaps i'm missing something. if you immediately notice anything in the code that would cause this error, let me know.

def smaller(image):
  target=makeEmptyPicture(1000,1000)
  sourceX=0
  sourceY=0
  for a in range(0,getWidth(image)):
    for b in range(0,getHeight(image)):
      color=getColor(getPixel(image,sourceX,sourceY))
      setColor(getPixel(target,a,B)/>,color)
      sourceX= sourceX + 2
      sourceY= sourceY + 2
  show(image)
  show(target)
  return

This post has been edited by Simown: 27 November 2011 - 07:59 PM
Reason for edit:: Added code tags. Please use code tags in future.


Is This A Good Question/Topic? 0
  • +

Replies To: Whats wrong with my scale down code?

#2 Simown  Icon User is offline

  • Blue Sprat
  • member icon

Reputation: 319
  • View blog
  • Posts: 650
  • Joined: 20-May 10

Re: Whats wrong with my scale down code?

Posted 28 November 2011 - 03:13 AM

It seems to me you are getting a ValueError from one of the functions, possibly converting to and from values in one of your functions - it's hard to tell without seeing the whole code.

Please could you point out the offending line of code and paste the function(s) called on that line.

This post has been edited by Simown: 28 November 2011 - 06:51 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1