0

I want to change my music's cover image. I've tried:

from mutagen.easyid3 import EasyID3
from mutagen.id3 import ID3, APIC

audio = EasyID3('11.mp3')
audio['artist'] = "Artist"
audio['title'] = "11"
audio.save()

audio = ID3('11.mp3')
with open('img.jpg', 'rb') as albumart:
    audio['APIC'] = APIC(
        encoding=3,
        mime='image/jpeg',
        type=3, desc=u'Cover',
        data=albumart.read()
    )            
audio.save()

MP3 file with default icon

But the cover has not changed. My project folder:

project
--- main.py
--- 11.mp3
--- img.jpg
AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Nurjalol N
  • 21
  • 1
  • 8
  • If you open this file `11.mp3` in a specialized tool like Mp3tag, do you see the cover there? – PeterCo Jan 18 '23 at 07:31
  • Then your code seems to work fine. You would have to check in your File Explorer (Windows?) why the thumbnail was/will not be created. As long as you see the cover art in Mp3tag, you can be sure, that the cover is embedded in 11.mp3 – PeterCo Jan 18 '23 at 14:02
  • 1
    But I use linux and I opened it with telegram and it works! – Nurjalol N Jan 18 '23 at 14:10

0 Answers0