如何在python中删除flac文件的隐蔽艺术

问题描述

我有一些flac歌曲,它们都有不同的封面艺术。我真的很想用我自己的 .png 删除或更改隐蔽艺术

到目前为止我尝试过的:

from mutagen import File
from PIL import Image

img = Image.open('art.png')
file = File('ZAYN - PILLOWTALK.flac')

file.pictures[1] = img

file.save()

但没有这样做。

提前谢谢。

解决方法

经过一番研究,发现mutagen.flac.pictures[0].data是字节类型,所以我给它分配了一个空字节。对于这里的代码。

from mutagen.flac import FLAC

audio = FLAC("ZAYN - PILLOWTALK.flac")
audio.pictures[0].data = b''
audio.save()

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...