[Python] How do I add cover image to a mp3 file using mutagen in Python?

Discussão em 'Python' iniciado por Stack, Agosto 1, 2025.

  1. Stack

    Stack Membro Participativo

    The code below doesnt seem to update the artwork of the mp3 file. Code:-

    from mutagen.id3 import ID3, APIC
    audio = ID3(musicFilename)
    with open(coverFilename, 'rb') as albumart:
    print albumart.read()
    audio['APIC'] = APIC(
    encoding=3,
    mime='image/jpeg',
    type=3, desc=u'Cover',
    data=albumart.read()
    )
    audio.save()


    After running the script, the cover of the mp3 file remain empty.

    Continue reading...

Compartilhe esta Página