1

I am using the code below to save a picture to song tag. I cant see the picture in File explorer or Some media player.
The pictures is saving but the file icon isn't changing and the picture isn't visable with Media Player for exmple Groove on windows. but I can see the picture when debbging

TagLib.File file = TagLib.File.Create(Server.MapPath("/A$AP Rocky - Everyday (Audio) ft. Rod Stewart, Miguel, Mark Ronson.mp3"));
System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath("/default.jpg"));
TagLib.Picture pic = new TagLib.Picture();
pic.Type = TagLib.PictureType.FrontCover;
pic.Description = "Cover";
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
MemoryStream ms = new MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Position = 0;
pic.Data = TagLib.ByteVector.FromStream(ms);
file.Tag.Pictures = new TagLib.IPicture[] { pic };
file.Save();
ms.Close();
cramopy
  • 3,459
  • 6
  • 28
  • 42
liad drori
  • 13
  • 5
  • 1
    I think that is more a problem with the corresponding applications than your code. It seems to me, that you made everything right, because the image is there in debug mode. I think that the problem is, that the album art is cached in groove as well as in windows explorer and thus the new image is not shown. – cramopy Dec 28 '17 at 20:40
  • As suggested by @cramopy, try some other tagging program to determine whether it is really a problem with your application. Any program should work, so just google for one, or if you'd take my recommendation, use [Mp3tag](https://www.mp3tag.de/en/download.html). Don't go with the name, it supports a host of other formats than mp3 too. – Fᴀʀʜᴀɴ Aɴᴀᴍ Feb 24 '18 at 10:35

0 Answers0