를 지금까지 내가 그것을 볼 수있는 이미지가 RGBA
입니다.
$ convert exportImage.png -verbose info
Image: exportImage.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: DirectClass
Geometry: 256x256+0+0
Units: Undefined
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Pixels: 65536
Red:
min: 39 (0.152941)
max: 253 (0.992157)
mean: 133.019 (0.521641)
standard deviation: 75.3931 (0.295659)
kurtosis: -1.05835
skewness: 0.86831
Green:
min: 59 (0.231373)
max: 253 (0.992157)
mean: 152.489 (0.597998)
standard deviation: 62.9948 (0.247038)
kurtosis: -1.03932
skewness: 0.87929
Blue:
min: 39 (0.152941)
max: 253 (0.992157)
mean: 135.817 (0.532617)
standard deviation: 72.8752 (0.285785)
kurtosis: -1.01856
skewness: 0.929917
Alpha:
min: 0 (0)
max: 255 (1)
mean: 185.273 (0.726562)
standard deviation: 113.659 (0.445723)
kurtosis: -0.966513
skewness: 1.01661
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 122.763 (0.481424)
standard deviation: 83.4891 (0.327408)
kurtosis: -0.482848
skewness: 0.432253
Alpha: srgba(253,253,253,0) #FDFDFD00 --------> (1)
등의 결과를 확인하십시오.
자, PIL
파이썬 3를 사용하여 이미지를로드 할 수 :
from PIL import Image
from io import BytesIO
url = "..."
resp = requests.get(url)
cont = BytesIO(resp.content)
img = Image.open(cont)
comp = Image.new('RGBA', (256, 256), (255, 255, 255, 0)) # 0 for transparency
comp.paste(img, (0, 0))
이 때문에는 식의의 (1) 위의 이미지 통계에 우리는 새로운 이미지를 만드는 경우도 0
을 제공했습니다.
감사합니다. 키가 "image.convert ('RGBA')"로 밝혀졌습니다. – magneticMonster