Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# -*- coding:utf-8 -*-
from PIL import Image
# 修正したい画像の読み込み
img ='元画像.png')
width = img.size[0]
height = img.size[1]
for x in range(width):
for y in range(height):
pixel = img.getpixel((x, y))
# アルファ値255以外を全部0にする
if(pixel[3] < 255):
img.putpixel((x, y), (0, 0, 0, 0))
# 修正後画像を保存'修正後画像.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.