FFMpegCore/FFMpegCore.Extensions.System.Drawing.Common/BitmapExtensions.cs

25 lines
636 B
C#
Raw Normal View History

using System.Drawing;
2019-02-08 11:19:40 +01:00
2022-03-24 20:19:37 +01:00
namespace FFMpegCore.Extensions.System.Drawing.Common
2019-02-08 11:19:40 +01:00
{
public static class BitmapExtensions
{
public static bool AddAudio(this Image poster, string audio, string output)
2019-02-08 11:19:40 +01:00
{
var destination = $"{Environment.TickCount}.png";
poster.Save(destination);
try
{
return FFMpeg.PosterWithAudio(destination, audio, output);
2019-02-08 11:19:40 +01:00
}
finally
{
if (File.Exists(destination))
{
File.Delete(destination);
}
2019-02-08 11:19:40 +01:00
}
}
}
}