namespace FileFlows.ImageNodes.Images; /// /// Converts an image to another format /// public class ImageConvert: ImageNode { /// public override int Inputs => 1; /// public override int Outputs => 2; /// public override FlowElementType Type => FlowElementType.Process; /// public override string HelpUrl => "https://fileflows.com/docs/plugins/image-nodes/image-convert"; /// public override string Icon => "fas fa-file-image"; /// protected override Result PerformAction(NodeParameters args, string localFile, string destination) { var format = GetImageTypeFromFormat(); if (format == null) { args.Logger?.ILog("Format not set, nothing to do."); return false; } if (args.WorkingFile.ToLowerInvariant().EndsWith("." + Format.ToLowerInvariant())) { args.Logger?.ILog("File already in format: " + Format); return false; } return args.ImageHelper.ConvertImage(localFile, destination, format.Value, Quality); } }