Question

Trying to add Album art using c# tag lib,

  TagLib.File trackFile = TagLib.File.Create(strLocalFile);
  Picture picture = new Picture("Picture path");
  picture.Type = PictureType.FrontCover;
  picture.MimeType = "image/jpeg";
  picture.Description = "Front Cover";        
  trackFile.Tag.Pictures = new IPicture[1] { picture };
  trackFile.Save();

I get picture in windows media player, itunes and iphone (only in portrait mode). When i switch to landscape mode, album art is displayed but when slide across the cover flow album art disappears.

Am i missing something in code ?

I use iTunes 11, iOS 6 on iPhone 4s

No correct solution

OTHER TIPS

Let me cite myself:

I found that iTunes hates UTF-16 and that's what's the problem there.

targetMp3File = TagLib.File.Create(...);

// define picture
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(...);

// save picture to file
targetMp3File.Tag.Pictures = new TagLib.IPicture[1] { pic };    
targetMp3File.Save();

So essentially the whole thing is in the pic.TextEncoding line. Additionally i assigned the Mime Type through the .NET constant.

Source: Having trouble writing ArtWork with Taglib-sharp 2.0.4.0 in .Net

This should work for both iTunes and iPod/iPad/iPhone. BUT this works only for MP3 files...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top