2

I have a project for school where I have to create a collage that displays an image multiple times with changes to each image. I had an issue with the filze size of a previous image, but got that resolved and now have another issue. When running the collage program, it creates a different image for each function to change the image, then it displays a blank canvas with the message "Picture, filename None height 700 width 515" in JES. I need all of the images to display on that one canvas with their changes. Any help is appreciated

def copy(sourcePic,targetPic, tarX, tarY):
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  targetX = tarX
  for sourceX in range(0, getWidth(sourcePic)):
    targetY = tarY
    for sourceY in range(0, getHeight(sourcePic)):
      pxColor = getPixel(sourcePic, sourceX, sourceY)
      txColor = getPixel(targetPic, targetX, targetY)
      target = targetY + 1
    targetX = targetX + 1



def lighten(pictureTurtle):
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  for pxColor in getPixels(pictureTurtle):
    color = getColor(pxColor)
    color = makeLighter(color)
    setColor(pxColor, color)
  show(pictureTurtle)



def negative(pictureTurtle):
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  for pxColor in getPixels(pictureTurtle):
    red = getRed(pxColor)
    green = getGreen(pxColor)
    blue = getBlue(pxColor)
    negColor = makeColor(255-red,255-green,255-green)
    setColor(pxColor, negColor)
  show(pictureTurtle)



def grayscale(pictureTurtle):
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  for pxColor in getPixels(pictureTurtle):
    intensity = (getRed(pxColor)+getBlue(pxColor))/3
    setColor(pxColor,makeColor(intensity,intensity,intensity))
  show(pictureTurtle)


def rotate(pictureTurtle):
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  w,h = getWidth(pictureTurtle), getHeight(pictureTurtle)
  for y in xrange(h):
    for x in xrange(w):
      color = getColor(getPixel(pictureTurtle, x, y))
      targetPixel = getPixel(pictureTurtle, x, y)
      setColor(targetPixel, color)
  show(pictureTurtle)

def collage():
  pictureTurtle = makePicture(getMediaPath("turtle.jpg"))
  canvas = makeEmptyPicture(515, 700)
  copy(pictureTurtle,canvas,0,getHeight(canvas)-getHeight(pictureTurtle)-5)
  lighten(pictureTurtle)
  copy(pictureTurtle,canvas,50,getHeight(canvas)-getHeight(pictureTurtle)-5)
  negative(pictureTurtle)
  copy(pictureTurtle,canvas,100,getHeight(canvas)-getHeight(pictureTurtle)-5)
  grayscale(pictureTurtle)
  copy(pictureTurtle,canvas,12,75-5)
  rotate(pictureTurtle)
  copy(pictureTurtle, canvas,62, 75-5)
  show(canvas)
  return(canvas)
  • How big is the file corvette.jpg? My guess is that the image is too big to collate onto the canvas. – super_mario3d Oct 15 '16 at 02:37
  • I'm an idiot, that was the issue. Thanks. Now that I know that was the problem, I tried a different image that I think is more the correct size, and now it will display the changes on different instances of the image, and then after it runs them it will display a blank canvas that says "filename None". – SucksAtJython Oct 15 '16 at 23:11

0 Answers0