|
-
December 29th, 2010, 03:42 PM
#2
Re: TagLib # Writing Images to File
I found an answer to my question. Here is the code:
TagLib.File TagLibFile = TagLib.File.Create(strFilePath);
TagLib.IPicture[] pictFrames = new IPicture[imgAlbumArt.Length];
for (int i = 0; i < imgAlbumArt.Length; i++)
{
MemoryStream ms = new MemoryStream();
imgAlbumArt[i].Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] myBytes = ms.ToArray();
ByteVector byteVector = new ByteVector(myBytes, myBytes.Length);
TagLib.Picture picture = new Picture(byteVector);
TagLib.Id3v2.AttachedPictureFrame albumCoverPictFrame = new TagLib.Id3v2.AttachedPictureFrame(picture);
albumCoverPictFrame.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
albumCoverPictFrame.Type = TagLib.PictureType.FrontCover;
pictFrames[i] = (IPicture)albumCoverPictFrame;
}
TagLibFile.Tag.Pictures = pictFrames;
TagLibFile.Save();
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|