問題があります。イメージ内のオブジェクトを1行にする
だから、私はこのイメージを持っている、と私は1行に数字のすべてを入れたい:
しかし、私はこれだけだ:あなたが見ることができるようにそれが1であれば、
を、0、7 - すべての罰金ですが、4と3 ...
と私のコード:代わりに
def reshape_img(self):
width, height = self.img.size
new_img_list = []
for x in range(width):
white_y = 0
start_nr = False
for y in range(height):
red, green, blue = self.img.getpixel((x, y)) # Current color
if red != 255:
start_nr = True
new_y = y - white_y + 5
new_img_list.append((x, new_y, (red, green, blue)))
elif red == 255 and not start_nr:
white_y += 1
return new_img_list
def new_image(image_list):
background = (255, 255, 255, 255)
img = Image.new('RGB', (545, 20), background)
pixels = img.load()
for d in image_list:
pixels[d[0], d[1]] = d[2]
img.save('img2.png')
「4」だけでサンプルを作成できますか? [mcve]の作成方法を参照してください。 –