Trying to create mp3 attachments for personal use. Tried all the solutions here on StackO, but no one worked.
Here is what I have:
TagLib.File tagFile = TagLib.File.Create("C:\\Users\\Dom\\Desktop\\song.mp3");
TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
pic.Data = TagLib.ByteVector.FromPath("C:\\Users\\Dom\\Pictures\\picture.png");
tagFile.Tag.Pictures = new TagLib.IPicture[1] { pic };
tagFile.Tag.Album = "Album 1";
tagFile.Tag.Year = 1990;
tagFile.Save();
The album tag and the year tag are displayed in the default properties, and the program crashes or does not throw any errors. The image does not appear as a file icon or in the Windows media player. Image size is 300x300 pixels, if that matters.
source
share