批量将gif转png
---
from PIL import Image import os dirStr = 'D:/icon' for file in os.listdir(dirStr): if file.lower().endswith('.gif'): gif = Image.open(dirStr + '/' + file) base = os.path.splitext(file) try: gif.seek(0) frame = gif.copy() frame.save(dirStr + '/' + base[0]+ '.png') except EOFError: pass print(f'{file} finish')
---
浙公网安备 33010602011771号