Aiursoft.NiBot 8.0.28

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Aiursoft.NiBot --version 8.0.28                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Aiursoft.NiBot --version 8.0.28                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Aiursoft.NiBot&version=8.0.28                
nuke :add-package Aiursoft.NiBot --version 8.0.28                

NiBot

MIT licensed Pipeline stat Test Coverage NuGet version ManHours

A cli tool helps you to de-duplicate images in a folder.

Suppose you enjoy collecting images and intensively gather a large number of them from various websites to your hard drive every day. Soon, your hard drive accumulates tens of thousands of CG images with different sources and resolutions.

However, you discover that a significant portion of these downloaded CG images are duplicates, occupying precious disk space. Therefore, you urgently need a fast method to identify and remove duplicates from your CG directory. Since the sources of these downloads vary, traditional methods such as searching by file names are clearly inadequate for solving this problem; it's necessary to analyze the content of the images.

Install

Run the following command to install this tool:

dotnet tool install --global Aiursoft.NiBot

Usage

After getting the binary, run it directly in the terminal.

$ NiBot dedup
Option '--path' is required.

Description:
  De-duplicate images in a folder.

Usage:
  nibot dedup [options]

Options:
  -p, --path <path> (REQUIRED)                  Path of the folder to dedup.
  -ds, --duplicate-similar <duplicate-similar>  Similarity bar. This value means two image are considered as duplicates if their similarity is greater than it. Setting too small may cause different images to be considered as 
                                                duplicates. Suggested values: [96-100] [default: 96]
  -r, --recursive                               Recursively search for similar images in subdirectories. [default: False]
  -k, --keep <keep>                             Preference for sorting images by quality to determine which to keep when duplicates are found. Available options: 
                                                Colorful|GrayScale|Newest|Oldest|Smallest|Largest|HighestResolution|LowestResolution. [default: Colorful|HighestResolution|Largest|Newest]
  -a, --action <Delete|MoveToTrash|Nothing>     Action to take when duplicates are found. Available options: Nothing, Delete, MoveToTrash. [default: MoveToTrash]
  -y, --yes                                     No interactive mode. Taking action without asking for confirmation. [default: False]
  -e, --extensions <extensions>                 Extensions of files to dedup. [default: jpg|jpeg|png|jfif]
  -t, --threads <threads>                       Number of threads to use for image indexing. Default is 32. [default: 32]
  -v, --verbose                                 Show detailed log
  -?, -h, --help                                Show help and usage information

It will fetch all images in the folder and compare them with each other. If two images are similar enough, it will consider them as duplicates.

It will pick the best one based the --keep option. If the --action is set to Delete, it will delete the rest of the duplicates. If the --action is set to MoveToTrash, it will move the rest of the duplicates to the trash.

With the --interactive option, it will preview each photo and ask for confirmation before deleting files.

Install as a Class Library

You can also install this tool as a class library.

dotnet add package Aiursoft.NiBot.Core

Then you can use the DedupEngine class to de-duplicate images in your own code.

    services.AddLogging(builder =>
    {
        builder.AddConsole();
        builder.AddDebug();
    });
    services.AddTransient<DedupEngine>();
    services.AddTransient<ImageHasher>();
    services.AddTransient<BestPhotoSelector>();
    services.AddTransient<FilesHelper>();
    services.AddTaskCanon();
    var sp = services.BuildServiceProvider();
    var dedupEngine = sp.GetRequiredService<DedupEngine>();

That's it!

How to contribute

There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.

Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.

We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
8.0.33 63 11/12/2024
8.0.31 82 11/2/2024
8.0.30 81 10/10/2024
8.0.29 79 10/7/2024
8.0.28 83 10/7/2024
8.0.27 119 7/12/2024
8.0.26 89 7/9/2024
8.0.25 82 7/9/2024
8.0.24 93 7/8/2024
8.0.23 85 7/8/2024
8.0.21 104 7/6/2024
8.0.20 92 7/4/2024
8.0.19 87 7/3/2024
8.0.18 98 7/3/2024
8.0.17 95 7/3/2024
8.0.16 98 7/3/2024
8.0.15 89 7/3/2024
8.0.14 80 7/3/2024
8.0.13 108 6/29/2024
8.0.12 105 6/28/2024
8.0.11 102 6/27/2024
8.0.10 98 6/27/2024
8.0.9 138 6/26/2024
8.0.8 128 6/26/2024
8.0.7 119 6/26/2024
8.0.6 93 6/26/2024
8.0.5 107 6/26/2024
8.0.3 82 6/26/2024
8.0.2 100 6/26/2024
0.0.5 302 7/20/2023
0.0.4 190 5/17/2023