Update packages, fix CLI entry point, add parallel within-archive compression (-P)

- Updated 10 NuGet packages: SharpCompress 0.49.1, Magick.NET-Q8-x64 14.14,
  System.Drawing.Common 10.0, itext 9.6, Imazen.WebP 11.0, McMaster 5.1,
  iTextSharp 5.5.13.5, Imageflow 0.15.1, Magick.NET.SystemDrawing 8.0.23
- Fixed missing OnExecuteAsync -- CLI was throwing InvalidOperationException on launch
- Added -w|--new-webp flag (Imageflow encoder path; benchmarked consistently slower)
- Added -P|--par-archive: parallel image compression within each archive
  Batched 3-phase design: sequential read -> Parallel.For (ProcessorCount/2 threads)
  -> sequential write; ordering guaranteed by indexed slots; ~4-5x measured speedup
- Added par_archive to ProcessorFlags
- Added CLAUDE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 00:48:54 +02:00
parent 7661cf506d
commit 94f3fab41c
3 changed files with 100 additions and 31 deletions
+17 -23
View File
@@ -30,7 +30,6 @@ using ImageMagick;
using javax.xml.transform;
using System.Collections.Concurrent;
using iText.Barcodes.Dmcode;
using ZstdSharp;
using Xabe.FFmpeg.Downloader;
using System.Reflection;
using Microsoft.VisualBasic;
@@ -63,7 +62,10 @@ namespace ComicCompressor
//string progVersion = "Version 3.0.0 - (21/11/2024)";
// In core changed color of percent save to white
string progVersion = "Version 3.0.1 - (23/01/2025)";
//string progVersion = "Version 3.0.1 - (23/01/2025)";
// In core changed color of percent save to white
string progVersion = "Version 3.1.0 - (27/06/2027)";
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
#region INPUT_FLAGS
@@ -103,6 +105,12 @@ namespace ComicCompressor
[Option("-a|--copyall", Description = "Copy all unprocessed files")]
public bool DoCopyAll { get; } = false;
[Option("-w|--new-webp", Description = "Use Imageflow encoder (faster JPEG→WebP transcoding, no full pixel decode)")]
public bool NewWebp { get; } = false;
[Option("-P|--par-archive", Description = "Parallel image compression within each archive (~4-5x faster, uses half the CPUs)")]
public bool ParArchive { get; } = false;
#endregion
#region STATISTICS
@@ -153,19 +161,18 @@ namespace ComicCompressor
new_webp: false
);
private void OnExecute()
private async Task OnExecuteAsync()
{
File_statistics.Clear();
flags.File_statistics = File_statistics;
flags.New_webp = NewWebp;
flags.Par_archive = ParArchive;
myColors = new Color[names.Count()];
for(int i = 0; i< myColors.Length; i++)
for (int i = 0; i < myColors.Length; i++)
{
KnownColor randomColorName = names[randomGen.Next(names.Length)];
myColors[i] = Color.FromKnownColor(randomColorName);
myColors[i] = Color.FromKnownColor(randomColorName);
}
//ImageExtractor7.MainBox();
Stopwatch sw = Stopwatch.StartNew();
@@ -175,28 +182,15 @@ namespace ComicCompressor
Logger.Log(progVersion, LogLevel.Verbose, true);
//var progress = new Progress<ProgressInfo>( p => Logger.Log(p.ToString(), LogLevel.Verbose, true) );
//FFmpeg.SetExecutablesPath(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
//FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official,progress);
//==//FFmpeg.SetExecutablesPath (Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FFmpeg"));
//Logger.Log(FFmpeg.ExecutablesPath, LogLevel.Verbose, true);
IList<string> files = new FileParser().ListAllFiles(Input, Recursive);
Process(files);
await Process(files);
long time_query = sw.ElapsedMilliseconds;
Logger.Log($"ElapsedTime {time_query} ms", LogLevel.Verbose, true);
Console.ReadKey();
}
private async void Process(IList<string> files)
private async Task Process(IList<string> files)
{
Compressor compressor = new Compressor(Logger);
compressor.Quality = Quality;