mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Ensure disposal of opened Image instances (#249)
This commit is contained in:
parent
c2d28055c1
commit
b217ca4af0
1 changed files with 5 additions and 4 deletions
|
@ -303,12 +303,13 @@ public static bool Join(string output, params string[] videos)
|
||||||
public static bool JoinImageSequence(string output, double frameRate = 30, params ImageInfo[] images)
|
public static bool JoinImageSequence(string output, double frameRate = 30, params ImageInfo[] images)
|
||||||
{
|
{
|
||||||
var tempFolderName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, Guid.NewGuid().ToString());
|
var tempFolderName = Path.Combine(GlobalFFOptions.Current.TemporaryFilesFolder, Guid.NewGuid().ToString());
|
||||||
var temporaryImageFiles = images.Select((image, index) =>
|
var temporaryImageFiles = images.Select((imageInfo, index) =>
|
||||||
{
|
{
|
||||||
FFMpegHelper.ConversionSizeExceptionCheck(Image.FromFile(image.FullName));
|
using var image = Image.FromFile(imageInfo.FullName);
|
||||||
var destinationPath = Path.Combine(tempFolderName, $"{index.ToString().PadLeft(9, '0')}{image.Extension}");
|
FFMpegHelper.ConversionSizeExceptionCheck(image);
|
||||||
|
var destinationPath = Path.Combine(tempFolderName, $"{index.ToString().PadLeft(9, '0')}{imageInfo.Extension}");
|
||||||
Directory.CreateDirectory(tempFolderName);
|
Directory.CreateDirectory(tempFolderName);
|
||||||
File.Copy(image.FullName, destinationPath);
|
File.Copy(imageInfo.FullName, destinationPath);
|
||||||
return destinationPath;
|
return destinationPath;
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue