1

I keep trying to run this function:

def flipPic():
    #Set up source picture
    barbf=getMediaPath("barbara.jpg")
    barb=makePicture(barbf)
    #Now, for the mirroring
    mirrorPoint=219
    for X in range(0,mirrorPoint):
        for Y in range(0,291):
            pleft=getPixel(barb,X,Y)
            pright=getPixel(barb,Y,mirrorPoint + mirrorPoint - 1 - X)
            setColor(pright,(getColor(pleft)))
    show(barb)
    return(barb)

However, an error comes up on this line:

barb=makePicture(barbf)

It says:

Inappropriate argument value (of correct type).
An error occurred attempting to pass an argument to a function.

I'm not sure what the issue is as it is written the same way that is in my textbook. I am still learning how to program in python, is there something I doing wrong?

Sam
  • 11
  • 4
  • You should add as a tag the library that you are using. – zondo Mar 20 '16 at 12:54
  • I'm using jython in a program called jes(Jython Environment for Students). – Sam Mar 20 '16 at 12:57
  • I'm new to this site, what do you mean by library? – Sam Mar 20 '16 at 13:02
  • See [this](https://stackoverflow.com/questions/19198166/whats-the-difference-between-a-module-and-a-library-in-python) question. What I want is just for you to say what you are using to accomplish this. That is, what module or collection of modules are you using to manipulate your images? – zondo Mar 20 '16 at 13:06
  • Found the issue. The program was looking in the wrong folder for the images. Once I fixed that, the program worked. – Sam Mar 21 '16 at 04:14

1 Answers1

1

I'm not sure what library you are using but this is a simple call in Pillow. The commands are these:

    out = im.transpose(Image.FLIP_LEFT_RIGHT)
    out = im.transpose(Image.FLIP_TOP_BOTTOM)

Taken from this chapter in the docs.

armatita
  • 12,825
  • 8
  • 48
  • 49