Taglib 读取 MP3 内嵌专辑图

taglib 是一个 c# 的库,用来读写 ID3 的标签还是很好用的,昨天在折腾读取图片的问题,搞了好久,最后找到这里,http://geekswithblogs.net/sona…

不过自己改写了一下,发现可以不用这么多,最后如下

TagLib.IPicture[] pictures = f.Tag.Pictures;
if (pictures.Length > 0)
{
	Byte[] bytes = pictures[0].Data.ToArray();
	System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
	System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(ms);
	this.pictureBoxCover.Image = bitmap;
}
else
{
	this.pictureBoxCover.Image = null;
}

Leave a Reply

Your email address will not be published. Required fields are marked *