Import the random
Im=Image. Open (" E:/python_learn_program/project/learn/test/p.j pg ")
Img_size=im. Size
M=img_size [0] # read the width of the picture
N=img_size [1] # read the picture height
W=10 # Settings you want to cut the width of the picture
H=10 # Settings you want to cut the height of the picture
For I in range (10) : # tailor 100 random insets
X=random. Randint (0, m - w) # x cut out of the starting point coordinates range
Y=random. Randint (0, n - h) # y range
cut out of the starting pointRegion=im. Crop ((x, y, x + w, y + h))
# cutting areaRegion. The save (" E:/python_learn_program/project/learn/test "+ STR (I) +". JPG ")
The problem in the last line, delete the STR (I) there is no error
CodePudding user response:
Please post all the complete error message text, and your name,Again,
CodePudding user response:
Is it in other local variables defines the name for the STR