pythonmp3mutagenid3v2id3-tag

Mutagen's save() does not set or change cover art for MP3 files


I am trying to use Mutagen for changing ID3 (version 2.3) cover art for a bunch of MP3 files in the following way:

from mutagen.mp3 import MP3
from mutagen.id3 import APIC

file = MP3(filename)

with open('Label.jpg', 'rb') as albumart:
    file.tags['APIC'] = APIC(
        encoding=3,
        mime='image/jpeg',
        type=3, desc=u'Cover',
        data=albumart.read()
    )
file.save(v2_version=3)

However, the file (or at least the APIC tag) remains unchanged, as checked by reading the tag back. In the system file explorer, the file does show an updated Date modified, however. How can I get Mutagen to update the cover art correctly?


Solution

  • I needed to set the cover to the "APIC:" tag, instead of the "APIC" tag (which I guess is how IDv2.3 is specified).