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.
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.
查看 MSDN 示例以显示任何文件的缩略图。它还包括如何检索专辑封面。
如果您想保存专辑封面,请查看如何在 Windows 8 Metro 应用程序中将保存的缩略图图像存储在设备中 c#
更新 1
MediaFile
是StorageFile
。ImageControl
是<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;
}
}
这是我针对第三个 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));
我在这里找到了一个解决方案How to: Get IDE Tags and Thumbnails of a file
var bitmapImage = new BitmapImage();
//Get Album cover
using (StorageItemThumbnail thumbnail = await file.GetThumbnailAsync(ThumbnailMode.MusicView, 300))
{
if (thumbnail != null && thumbnail.Type == ThumbnailType.Image)
{
bitmapImage.SetSource(thumbnail);
}
else
{
//Error Message here
}
}