Skip to content

Commit

Permalink
Reverted uint to int in options
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleSwift committed Jan 1, 2025
1 parent 9a94e25 commit c6177b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/MainAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public Task StartAsync(CancellationToken cancellationToken)
var (Columns, Rows) = options.GetNumOfColumnsAndRows(stitchCountPerImage);
var processOptions = new ImageProcessOptions
{
Rotate = (int) options.Rotation,
Rotate = options.Rotation,
Scale = options.Scale,
SavedImageExtension = options.Encoding,
BorderSize = (int) options.BorderSize,
BorderSize = options.BorderSize,
Columns = Columns,
Rows = Rows
};
Expand Down
10 changes: 5 additions & 5 deletions src/Options/AppOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AppOptions
public IEnumerable<string>? Files { get; set; }

[Option('i', "input", Required = true, SetName = "allFilesFromDir", HelpText = "Input directory. The directory where images to stitch will be searched for. Stitch order method can be changed with -m.")]
public string? InputPath { get; set; }
public string? InputPath { get; set; } = null;

[Option('t', "take", Required = false, HelpText = "Supply the number of images to be stitched together. When not set, all input images will be stitched into one image. Value should be at least 2.")]
public uint? TakeImageCount { get; set; } = null;
Expand All @@ -23,19 +23,19 @@ class AppOptions
public string Encoding { get; set; } = "jpg";

[Option('r', "rotate", Required = false, HelpText = "Rotate the images N degrees.", Default = 0)]
public uint Rotation { get; set; } = 0;
public int Rotation { get; set; } = 0;

[Option('s', "scale", Required = false, HelpText = "Scale the final image. Ex.: 0.5 to scale down 50% or 1.5 to scale up 150%.", Default = 1.0f)]
public float Scale { get; set; } = 1.0f;

[Option('b', "borderSize", Required = false, HelpText = "Add a border around the stitched images. Value in pixels.", Default = 0)]
public uint BorderSize { get; set; } = 0;
public int BorderSize { get; set; } = 0;

[Option('w', "gridWidth", Required = false, HelpText = "Number of images to stack vertically (columns). Leave 0 for best guess.", Default = 0)]
public uint Width { get; set; } = 0;
public int Width { get; set; } = 0;

[Option('h', "gridHeight", Required = false, HelpText = "Number of images to stack horizontally (rows). Leave 0 for best guess.", Default = 0)]
public uint Height { get; set; } = 0;
public int Height { get; set; } = 0;

[Option("wh", Required = false, HelpText = "Alternative way to supply width and height of grid. Format: WxH Ex.: 2x1")]
public string? WidthHeight { get; set; } = null;
Expand Down
4 changes: 3 additions & 1 deletion src/Options/AppOptionsValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ public static bool ValidateOptions(AppOptions appOptions, ILogger logger, int im
errors.Add("An input path must be provided. Either provide at least two input images or an input directory.");
if (imageCount == 1)
errors.Add("Image count should be larger than 1.");
if (appOptions.Rotation > 359)
if (appOptions.Rotation < 0 || appOptions.Rotation > 359)
errors.Add("Rotation should be between 0 and 359.");
if (appOptions.Scale < 0.1f || appOptions.Scale > 2.0f)
errors.Add("Scale should be between 0.1 and 2.0.");
if (appOptions.BorderSize < 0)
errors.Add("Border size should be 0 or larger.");
if (wXh.Rows < 1)
errors.Add("Height should be at least 1.");
if (wXh.Columns < 1)
Expand Down

0 comments on commit c6177b9

Please sign in to comment.