Taglib album image

patrick machielse patrick at hieper.nl
Sun Mar 4 00:43:47 UTC 2018


Op 4 mrt. 2018, om 01:11 heeft Mark P <mark_np at hotmail.it> het volgende geschreven:

> Hi, 
> 
> Any good Samaritan would be willing to help me on how to extract image album from on specific path using visual studio with c++. 
> With the code in example folder I can get every tag from mp3, m4a, wav and wma but I don't know how to get album art. 
> I only managed to extract it from mp3 using another library (id3lib) and I would need to get it from other audio format. 
> It has been 4-5 days that I'm searching on the net without finding anything about taglib relative to my problem. I found a method in an answer of taglib's developer on stack overflow but it applies only to mp3 and I don't know how to convert it and save it as an image from the struct it returns. I found other methods always on Google but they are not working. 

You need to access the appropriate frame or atom in your tag.

Some aproximate code to get you started:

For ID3:

for ( auto it : v2Tag->frameList("APIC") ) {
    AttachedPictureFrame *apic = dynamic_cast<AttachedPictureFrame *>(it);
    if ( apic ) {
	// use apic->picture().data() of apic->picture().size() to create an image in your app framework
    }
}


For mp4:

CoverArtList coverArtList = tag->itemListMap()["covr"].toCoverArtList();
for ( auto it : coverArtList ) {
    CoverArt pic = static_cast<CoverArt >(it);
    // use pic->data().data() of pic.data().size() to create an image in your app framework
}

Hope this helps,

patrick
--
Patrick Machielse
Hieper Software

http://www.hieper.nl
info at hieper.nl



More information about the taglib-devel mailing list