How to get/search cover image of track?

musicbrainz
webservice
coverartarchive
cover-art
Tags: #<Tag:0x00007f2a11116218> #<Tag:0x00007f2a111160d8> #<Tag:0x00007f2a11115f98> #<Tag:0x00007f2a11115d68>

#1

Hi,

I want to get the cover image of track. How can i do that? Can anybody give an example?

Thanks


#2

Can you give us the MusicBrainz-URL for your track, like


#3

Let me describe what i want to achieve…

-> user can search track cover image by name and it should return list of images from which user can select correct track image .

I did’t get what do you mean by ‘MusicBrainz-URL’?


#4

First thing to note is that MusicBrainz does not store images per track, but per release. Is that what you want?

Also it is not clear what exactly you are doing. Are you developing some software, and in that software the user can search for a track name and get the corresponding album artwork?

If that’s the use case you can use the MusicBrainz API and Cover Art Archive API for this.

The basic idea would be that you search for a recording with the entered name and include all releases with the result, like this for “Paint it Black”:

https://musicbrainz.org/ws/2/recording/?query=recording:"Paint%20It%20Black"%20AND%20status:official%20AND%20primarytype:album&inc=releases

There might be more than one recording, so you will have to look at several for the best match for your use case. A recording will also be often on multiple releases, so you have to filter the releases as well. Maybe you want to focus on primarytype “album” and secondarytype not set at all. If there is not primarytype “album”, fall back to “single” or “ep”. Maybe sort by release date, so you get the earliest available one. You can also display the user multiple results.

Once you have a release ID you can query the Cover Art Service:

https://coverartarchive.org/release/37b9a29b-2d39-441b-9ac6-81770916e5b5

Not every release will have cover art of course.