Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
13 lines
504 B
Python
13 lines
504 B
Python
from PIL import Image
|
|
im = Image.open(r"C:\Users\28579\Downloads\resources\resources\netherstar.png")
|
|
print("模式:", im.mode)
|
|
print("尺寸:", im.size)
|
|
print("有 alpha:", im.mode in ("RGBA", "LA"))
|
|
if im.mode in ("RGBA", "LA"):
|
|
a = im.getchannel("A")
|
|
print("alpha bbox:", a.getbbox())
|
|
print("alpha 范围:", a.getextrema())
|
|
# 采样角落像素,看是不是白/透明
|
|
w, h = im.size
|
|
print("左上角:", im.getpixel((0, 0)))
|
|
print("中心:", im.getpixel((w // 2, h // 2))) |