Page 1 of 1

Taglib sharp album cover tutorial

Posted: Tue Aug 03, 2010 12:15 pm
by frozerlaxegon
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.
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

Re: Taglib sharp album cover tutorial

Posted: Wed Aug 04, 2010 10:53 am
by Agust1337
Have you tried Function instead of Private sub?

Re: Taglib sharp album cover tutorial

Posted: Wed Aug 04, 2010 2:27 pm
by mandai
What return variable/type should it be expecting?

Re: Taglib sharp album cover tutorial

Posted: Thu Aug 05, 2010 2:19 pm
by frozerlaxegon
mandai wrote:
What return variable/type should it be expecting?
It returns nothing, it is suppose to be returning a picture of the album cover art.