question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Album cover isn't being added to the song file

See original GitHub issue

The album cover isn’t being added to the song file. Am I doing it wrong? And how would I use an image from a url?

const NodeID3 = require('node-id3')
let fs = require('fs');

let file = "./aPI2NJyzFZlc.128.mp3"

let tags = {
    title: "Tomorrow",
    artist: "Kevin Penkin",
    album: "TVアニメ「メイドインアビス」オリジナルサウンドトラック",
    APIC: "./cover.jpg",
    TRCK: "27"
  }
   
NodeID3.create(tags)
   
let success = NodeID3.write(tags, file)
NodeID3.write(tags, file, function(err, buffer) {  })
console.log(success)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Zazamacommented, Oct 2, 2020

No, a buffer is a Buffer object, which has the data of the image. (see https://nodejs.org/api/buffer.html) You have to download it first like this

request.get({ url: imageurl, encoding: null }, function (err, res, buffer) {
    // buffer is the imageBuffer
});
1reaction
Zazamacommented, Oct 2, 2020

Your code works for me, your cover.jpg is probably in a different directory?

And how would I use an image from a url

You can download it and pass the buffer using

image: {
  mime: "jpeg",
  type: {
    id: 3,
    name: "front cover
  },
  imageBuffer: yourBuffer
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix no album art in File Explorer on Windows 10
Open the Groove app and go to albums tab. Look for your song file there. Click the Edit Info button. If you don't...
Read more >
Can't add an album art to a song in mp3 format
Hello I tried to add the album art to mp3 songs(Trying through different softwares). ... They shows an error message"This file isn't playable....
Read more >
Can't manually add artwork to Music (iTunes for Mac)
I'm unable to manually add artwork to a song. The song file is MP3. I choose Get Info for the song, and have...
Read more >
Solved: Adding Cover Art to Local Files
I got it to work by adding the cover artwork in itunes first and then transfering songs into spotify through local files and...
Read more >
Can't Add Artwork in iTunes? Greyed Out? Here's How to Fix
Having issues adding Artwork to your iTunes Albums and Songs? We got you covered with our top tips to get your artwork back...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found