mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-01-06 09:19:30 -06:00
fixed image and comics plugins
This commit is contained in:
@@ -6,6 +6,24 @@ public abstract class ImageBaseNode:Node
|
||||
{
|
||||
|
||||
private const string IMAGE_INFO = "ImageInfo";
|
||||
protected IImageFormat CurrentFormat { get; private set; }
|
||||
protected int CurrentWidth{ get; private set; }
|
||||
protected int CurrentHeight { get; private set; }
|
||||
|
||||
public override bool PreExecute(NodeParameters args)
|
||||
{
|
||||
using var image = Image.Load(args.WorkingFile, out IImageFormat format);
|
||||
CurrentHeight = image.Height;
|
||||
CurrentWidth = image.Width;
|
||||
CurrentFormat = format;
|
||||
var metadata = new Dictionary<string, object>();
|
||||
metadata.Add("Format", CurrentFormat.Name);
|
||||
metadata.Add("Width", CurrentWidth);
|
||||
metadata.Add("Height", CurrentHeight);
|
||||
args.SetMetadata(metadata);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void UpdateImageInfo(NodeParameters args, Dictionary<string, object> variables = null)
|
||||
{
|
||||
using var image = Image.Load(args.WorkingFile, out IImageFormat format);
|
||||
@@ -57,6 +75,13 @@ public abstract class ImageBaseNode:Node
|
||||
variables.AddOrUpdate("img.IsPortrait", imageInfo.IsPortrait);
|
||||
variables.AddOrUpdate("img.IsLandscape", imageInfo.IsLandscape);
|
||||
|
||||
var metadata = new Dictionary<string, object>();
|
||||
metadata.Add("Format", imageInfo.Format);
|
||||
metadata.Add("Width", imageInfo.Width);
|
||||
metadata.Add("Height", imageInfo.Height);
|
||||
args.SetMetadata(metadata);
|
||||
|
||||
|
||||
args.UpdateVariables(variables);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user