Hi there ,

i created a music player with c# , but i have two problems :

  1. If you attention to music files they have a picture (for example : picture of its singer ) how can i access to this image in my app and how can i set it as a picture to an picture box ?
  2. how can i access its name and its singer name and so on ( how can i read file info ) ?

Thanks . :)

Recommended Answers

All 8 Replies

Any help ?

thanks ,
i using TagLib Sharp with C# but i don't know how can i access to music picture and showing it .

do you know how i access to picture of music files ?

That depends on the Library you are using.

You will have to read the documentation on TagLib Sharp, read the info on how to Implement get the picture information.

i can't use this code :

TagLib.File file = TagLib.File.Create((FilePath); //FilePath is the audio file location

                TagLib.IPicture pic=file.Tag.Pictures[0];  //pic contains data for image.



                MemoryStream stream = new MemoryStream(pic.Data.Data);  /create an in memory stream

              Image im = new Image();


              BitmapFrame bmp = BitmapFrame.Create(stream);

              im.Source = bmp;

http://geekswithblogs.net/sonam/archive/2009/06/11/extracting-album-from-an-audio-file.aspx

1) i don't know how can i use BitmapFrame , actually where is it :D ?
2) i can't find a method like "Source" in "Image" library .

Can you give me an example form this ?

Try doing something like this:

MemoryStream stream = new MemoryStream(pic.Data.Data);  //create an in memory stream
Bitmap image = (Bitmap)Bitmap.FromStream(stream);
PictureBox1.Image = image; //then you have to display the image in a picture box....
PictureBox1.Show();

Remember, you have to create PictureBox1 using the toolbox, (or declaring a new one by yourself using code)...

For info on PictureBox class read here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.aspx

Thank you so much .

Please mark this thread as "Solved" if you were able to get your code working ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.