Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Albumart in .mp3 file for Windows Store App

How can i get the AlbumArt image in the mp3 file? I am developing Windows Store app with c#.

MusicProperties class gives me Album name artist name vs. But it cant give me albumart.

like image 382
Metehan Toksoy Avatar asked Sep 14 '13 23:09

Metehan Toksoy


2 Answers

Check out MSDN sample to show thumbnail of any file. It also consists how to retrieve the album art.

File and folder thumbnail sample

If you want to save the album art check out How to store save Thumbnail image in device in windows 8 metro apps c#

UPDATE 1

MediaFile is StorageFile. ImageControl is <Image ... />

using (StorageItemThumbnail thumbnail = await MediaFile.GetThumbnailAsync(ThumbnailMode.MusicView, 300))
{
    if (thumbnail != null && thumbnail.Type == ThumbnailType.Image)
    {
        var bitmapImage = new BitmapImage();
        bitmapImage.SetSource(thumbnail);
        ImageControl.Source = bitmapImage;
    }
}
like image 50
Farhan Ghumra Avatar answered Sep 19 '22 13:09

Farhan Ghumra


here's my quick and short solution for that problem thirding TagLib#: (http://taglib.github.io/)

using TagLib;
var file = TagLib.File.Create(filename);
var bin = (byte[])(file.Tag.Pictures[0].Data.Data);
imageBox.Image = Image.FromStream(new MemoryStream(bin));
like image 37
cramopy Avatar answered Sep 21 '22 13:09

cramopy