title: Blending two pictures together using Jython
body: <p>I am tring to blend 2 pictures together and everytime I run this I get the error:</p>
  
  <pre><code>getPixel(picture,x,y): x (= 310) is less than 0 or bigger than the width (= 309)
  </code></pre>
  
  <p>The error value is: </p>
  
  <pre><code>Inappropriate argument value (of correct type).
  An error occurred attempting to pass an argument to a function.
  Please check line 18
  </code></pre>
  
  <p>I have resized the images multiple times to see if that would work and it does not. Any help would be great.</p>
  
  <p>As of right now I have my pics are sized as follows:<br>
  Antelope=310x369<br>
  Jackolope=250x341</p>
  
  <pre><code>def blendPictures():                #define a new function
    Pic1=makePicture(pickAFile())     #Pick Pic1 Antelope(Barb)
    Pic2=makePicture(pickAFile())     #Pick Pic2 Jackalope(Katie)
    canvas=makeEmptyPicture(640,480)  #Create an empty picture file
    sourceX=0
    for targetX in range(0,150):      #Let's ad our first loop
      sourceY=0
      for targetY in range(0,getHeight(Pic1)):
        color = getColor(getPixel(Pic1,sourceX,sourceY))
        setColor(getPixel(canvas,targetX,targetY),color)
        sourceY = sourceY + 1
      sourceX = sourceX +1
    overlap = getWidth(Pic1)-150
    sourceX=0
    for targetX in range(150,getHeight(Pic1)):
      sourceY=0
      for targetY in range(0,getHeight(Pic2)):
        APixel = getPixel(Pic1,sourceX+150,sourceY)
        BPixel = getPixel(Pic2,sourceX,sourceY)
        newRed=0.50*getRed(APixel)+0.50*getRed(BPixel)
        newGreen=0.50*getGreen(APixel)+0.50*getGreen(BPixel)
        newBlue=0.50*getBlue(APixel)+0.50*getBlue(BPixel)
        color=makeColor(newRed,newGreen,newBlue)
        setColor(getPixel(canvas,targetX,targetY),color)
        sourceY=sourceY+1
      sourceX=sourceX+1
    sourceX=overlap
    for targetX in range(150+overlap,150+getWidth(Pic2)):
      sourceY=0
      for targetY in range(0,getHeight(Pic2)):
         color=getColor(getPixel(Pic2,sourceX,sourceY))
         setColor(getPixel(canvas,targetX,targetY),color)
         sourceY=sourceY+1
      sourceX=sourceX+1
    show(canvas)
    return canvas
  </code></pre>