By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 927 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

id3v2 mp3 image metadata

P: 16
does anyone know at what point in an mp3 the image metadata is located? and if you do know, how do you convert the binary data into an image in a picturebox?
Feb 11 '09 #1
Share this Question
Share on Google+
3 Replies


vekipeki
Expert 100+
P: 229
You are using TagLib#, right? Did you check their example:

Expand|Select|Wrap|Line Numbers
  1. try
  2. {
  3.    TagLib.File file = TagLib.File.Create ("/path/to/music/file.mp3");
  4.    TagLib.Id3v2.Tag tag = file.GetTag (TagLib.TagTypes.Id3v2);
  5.  
  6.    // The file contains an ID3v2 tag.
  7.    if (tag != null)
  8.       foreach (TagLib.Id3v2.AttachedPictureFrame frame
  9.                       in tag.GetFrames ("APIC"))
  10.          SomeImageProcess (frame.Picture.Data);
  11. }
  12. catch {...}
Feb 11 '09 #2

P: 16
yep taglib#, i looked at their example but i dont quite get it.

ive done what you suggested but it does not work
ive gotten error that says

"Cannot implicitly convert type 'TagLib.Tag' to 'TagLib.Id3v2.Tag'. An explicit conversion exists (are you missing a cast?)"

i also wish to display the picture in a picturebox

tnx!
Feb 11 '09 #3

vekipeki
Expert 100+
P: 229
I haven't used this so I cannot help.

Presuming that the returned TagLib.Tag can be cast to TagLib.Id3v2.Tag, the error that you are receiving could be solved with:

Expand|Select|Wrap|Line Numbers
  1. TagLib.Id3v2.Tag tag = file.GetTag (TagLib.TagTypes.Id3v2) as TagLib.Id3v2.Tag;
  2.  
Try to get any image data to see what the returned format is, then you will decide how to display it. If it is a Bitmap object, then you can pass it to PictureBox.Image property and you're done. If not, then you will have to find or implement some conversions.
Feb 11 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.