Home > other >  Extra argument python
Extra argument python

Time:04-26

So im try to crop an image with PIL but it says i am using 5 arguments.

im.crop((im_x / total_x_frames) * frame, 0 ,(im_x / total_x_frames) * (frame   1), im_y / total_y_frames)

CodePudding user response:

From the Pillow docs it looks like the crop method takes a tuple with 4 values for the coordinates. Parentheses suggested by Brian should work because it will make your argument a single tuple.

im.crop(((im_x / total_x_frames) * frame, 0 ,(im_x / total_x_frames) * (frame   1), im_y / total_y_frames))

CodePudding user response:

try extra parenthesis im.crop( ((im_x / total_x_frames) * frame, 0 ,(im_x / total_x_frames) * (frame 1), im_y / total_y_frames))

  • Related