我怎样才能把这张图片保存成高清的呢?

本文关键字:保存 高清 张图片 | 更新日期: 2023-09-27 18:05:21

我正在尝试修改我的歌曲的元数据。我做到了这一点,但如果用户没有指定专辑图像,我将自动从包含专辑图像的图片框中绘制一个。返回的图像真的很模糊,我能不能把它弄得尽可能高一些?下面是我处理这个问题的代码部分:

 if (isDir == false){
            IPicture art2 = new TagLib.Picture(new TagLib.ByteVector((byte[])new System.Drawing.ImageConverter().ConvertTo(pictureBox1.Image, typeof(byte[])))); //I make the new picture here.
            TagLib.File file2 = TagLib.File.Create(Properties.Settings.Default.NowPlayingPath);
            file2.Tag.Title = SongBox.Text;
            file2.Tag.AlbumArtists = artist;
            file2.Tag.Genres = genre;
            file2.Tag.Year = Convert.ToUInt32(YearBox.Text);
            file2.Tag.Composers = composers;
            file2.Tag.Pictures = new IPicture[1] { art2 };//I set the picture here.
            file2.Save();
            MessageBox.Show("You'll need to reload your song to continue listening to it.", "Settings saved.");
            this.Hide();
        }
    }

我怎样才能把这张图片保存成高清的呢?

尝试使用MemoryStream获取图像作为字节数组:

MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] buff = ms.GetBuffer();
IPicture art2 = new TagLib.Picture(new TagLib.ByteVector(buff));