Files
Starlight_Lancher/tools/icon_work/sample_edge.py
Ap_Tx 8e9b0894ba
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
fix:一些显示bug
2026-09-13 18:25:36 +08:00

19 lines
770 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from PIL import Image
im = Image.open(r"C:\Users\28579\Downloads\resources\resources\netherstar.png").convert("RGBA")
w, h = im.size
print("尺寸:", (w, h))
# 采样边缘一圈alpha 低但 RGB 接近白的像素 = "脏"边缘)
dirty = 0
total_edge = 0
for y in range(0, h, 3):
for x in range(0, w, 3):
r, g, b, a = im.getpixel((x, y))
if 0 < a < 255:
total_edge += 1
# alpha 半透明,但 RGB 很亮(接近白)—— 这就是"没剔干净"的迹象
if r > 240 and g > 240 and b > 240:
dirty += 1
print("半透明像素总数:", total_edge)
print("半透明中 RGB 接近白的(脏边缘):", dirty)
if total_edge:
print("脏边比例: {:.1f}%".format(dirty / total_edge * 100))