id3 display album image in mp3 file using c# mvc Razor

Asked

Viewed 49 times

2

I’m building an application in C# and ASP.NET MVC and Razor that reads data from mp3 files, but I can’t display the album image. I have tried several available libraries, I extract all information except the album image (art cover album), I believe it is necessary to convert the bitmap information to jpeg or some other format to display via <img src>.

Can someone help me?

1 answer

0

This library does in a practical way what you need. This extension will also be required.

The idea is you convert this PictureManager for Web. The idea is to load the file using a PictureFrame. The idea is to use FrameExtensions for that reason:

using System.IO;

using Id3.Frames;

namespace Id3
{
    public static class FrameExtensions
    {
        public static void LoadImage(this PictureFrame frame, string filePath)
        {
            frame.PictureData = File.ReadAllBytes(filePath);
        }

        public static void SaveImage(this PictureFrame frame, string filePath)
        {
            File.WriteAllBytes(filePath, frame.PictureData);
        }
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.