私はプログラムを読み込んでイメージを作り、それを別の部分に分割し、これらの差分部分をフォルダに保存しようとしています。しかし、代わりにトリミングされた画像を保存することは、それが全体の画像を保存画像全体pygame.transform.chop not working
import sys, pygame
from pygame import *
pygame.init()
while True:
image=pygame.image.load(raw_input("Enter the file: "))
rows=int(input("Enter the number of rows: "))
columns=int(input("Enter the number of columns: "))
output=raw_input("Enter the output folder: ")
width=image.get_width()/columns
height=image.get_height()/rows
print ("In progress...")
for i in range(0, rows):
for j in range(0, columns):
cropped_image=pygame.transform.chop(image, (j*columns, i*rows, width, height))
cropped_output=output+"/" + str(i)+"_"+str(j)+".png"
pygame.image.save(cropped_image, cropped_output)
print ("completed")
代わりにcropped_image(画像の一部のみ)を保存を保存します。なぜそれが働かないのか? ありがとう
ありがとう!できます! – John
これはまったく同じ間違いです。 –