Taglib sharp album cover tutorial
Posted: Tue Aug 03, 2010 12:15 pm
Hi, I wanted to get the embedded cover art of a music file I'm playing using taglib-sharp.
Here's my code, please help!
On form_load, I've already added SetAlbumArt() so that can't be the cause of the problem.
Here's my code, please help!
On form_load, I've already added SetAlbumArt() so that can't be the cause of the problem.
Code: Select all
Private Sub SetAlbumArt()
On Error Resume Next
If Playlist.List.SelectedItem IsNot Nothing Then
Dim file As TagLib.File = TagLib.File.Create(Playlist.List.SelectedItem.ToString())
If file.Tag.Pictures.Length > 0 Then
Dim bin = DirectCast(file.Tag.Pictures(0).Data.Data, Byte())
pb.Image = Image.FromStream(New IO.MemoryStream(bin)).GetThumbnailImage(100, 100, Nothing, IntPtr.Zero)
Else
pb.Image = My.Resources.sry
End If
End If
End Sub