### ShareX Integration Example Source: https://context7.com/decimation/smartimage/llms.txt This example shows how to configure SmartImage for integration with ShareX. It specifies the executable path and the arguments to pass for image searching. ```bash # File path: SmartImage.exe # Arguments: -i "$input" -auto ``` -------------------------------- ### Basic SmartImage CLI Search Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage Demonstrates how to perform a basic image search using the SmartImage CLI with a direct image URI and specifying an output file. This is a fundamental example for getting started with the tool. ```bash ./SmartImage "https://i.redd.it/xixxli0axz7b1.jpg" -o output.csv ``` -------------------------------- ### SmartImage CLI with File Input and Options Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage Shows how to use the SmartImage CLI with a local image file, specifying all search engines, an auto-priority engine, interactive results, and reading browser cookies. This example highlights common options for enhanced searching. ```bash .\SmartImage -e All -p Auto 'Valerie XMAS 1-3.png' --interactive --read-cookies ``` -------------------------------- ### SmartImage GUI Basic Input (Windows) Source: https://context7.com/decimation/smartimage/llms.txt This is a basic command-line usage example for the SmartImage GUI application on Windows, specifying the input image file path. ```bash SmartImage.exe -i "C:\images\photo.png" ``` -------------------------------- ### Use SmartImage Command-Line Interface (Bash) Source: https://context7.com/decimation/smartimage/llms.txt Provides examples of using the SmartImage command-line interface (Rdx) for image searching. It demonstrates basic file and URL searches, saving results to CSV, specifying search engines, using presets, reading from the clipboard on Windows, and enabling browser cookie reading for authenticated searches. ```bash # Basic search with file ./SmartImage "/path/to/image.png" # Search URL and save results to CSV ./SmartImage "https://i.imgur.com/example.jpg" -o output.csv # Search with specific engines ./SmartImage "image.png" -e SauceNao,Iqdb,TinEye -p Auto # Use artwork preset engines with interactive results ./SmartImage -e Artwork -p Auto "artwork.png" --interactive # Read from clipboard (Windows) ./SmartImage.exe '' --clipboard -e Artwork -p Auto # Enable browser cookies for authenticated searches ./SmartImage "image.png" --read-cookies -e All ``` -------------------------------- ### SmartImage CLI Usage Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage This section details the various command-line arguments and options available for the SmartImage CLI tool. ```APIDOC ## SmartImage CLI Usage ### Description SmartImage.Rdx is the cross-platform command-line form of SmartImage. It allows users to search for images using various engines and options. ### Method N/A (Command-line tool) ### Endpoint N/A (Command-line tool) ### Parameters #### Global Options - **-h, --help** (flag) - Display help info - **-v, --version** (flag) - Display version info - **-e, --search-engines** (string array) - Search engines (comma-delimited). Example: `All`, `Artwork`, `Yandex` - **-p, --priority-engines** (string array) - Priority engines (comma-delimited). Example: `Auto` - **--read-cookies** (flag) - Reads browser cookies for more reliable search results (Firefox only, Windows only) - **--flaresolverr** (flag) - Use FlareSolverr - **--flaresolverr-api** (string) - FlareSolverr API URL - **--keep-open** (flag) - Waits for input before terminating - **-f, --output-format** (enum) - Output file format. Values: `None`, `Delimited` - **-o, --output-file** (string) - Output file path - **-d, --output-delim** (string) - Output file delimiter - **--output-fields** (string array) - Output fields. Values: `None`, `Name`, `Url`, `Similarity`, `Artist`, `Site` - **--cmd-exe** (string) - Command/executable to invoke upon completion - **--cmd-args** (string) - Arguments to pass to command - **--interactive** (flag) - Interactive results - **--clipboard** (flag) - Read query from clipboard (Windows only); input should be an empty string ### Input Input can be a direct image URI, a file path, or piped data (file path or binary image data). ### Examples #### Common Usage - Search by direct image URI, write results to `output.csv`: ```bash ./SmartImage "https://i.redd.it/xixxli0axz7b1.jpg" -o output.csv ``` - Search by file, use `All` search engines with `Auto` priority engine, display interactive results, read cookies from browser: ```bash .\SmartImage -e All -p Auto 'Valerie XMAS 1-3.png' --interactive --read-cookies ``` - Search by clipboard, use `Artwork` search engines with `Auto` priority engine. `''` is passed as a dummy query: ```bash SmartImage.exe '' --clipboard -e Artwork -p Auto ``` #### Advanced Usage - *(Linux)* Store file path in shell variable `cx1` which is piped to **SmartImage**; reads cookies, priority engines is set to `Auto`, search engines are `Artwork` and `Yandex`: ```bash cx1="/home/neorenegade/1654086015521.png" neorenegade@localhost:/mnt/c/Users/Deci/$ echo -nE $cx1 | ./SmartImage --read-cookies -p Auto -e Artwork,Yandex ``` - *(Windows)* Read image bytes into variable `$cx2` which is piped to **SmartImage**; reads cookies, priority engines is set to `Auto`, search engines are `Artwork` and `Yandex`: ```powershell $cx2=[System.IO.File]::ReadAllBytes($(Resolve-Path "..\..\Pictures\Art\Atago_final_1-3.png")) $cx2|.\SmartImage.exe --read-cookies -p Auto -e Artwork,Yandex ``` ### About **Last updated:** `2026-01-24 v1.2.0` ``` -------------------------------- ### SmartImage CLI with Clipboard Input Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage Illustrates using the SmartImage CLI to search based on an image copied to the clipboard. It specifies particular search engines and an auto-priority engine, passing an empty string as a dummy query as required. ```bash SmartImage.exe '' --clipboard -e Artwork -p Auto ``` -------------------------------- ### Pipe File Path for Search (Linux) Source: https://context7.com/decimation/smartimage/llms.txt This example shows how to pipe a file path to SmartImage on Linux systems. It also includes options to read cookies and specify search engines like Artwork. ```bash echo -n "/home/user/image.png" | ./SmartImage --read-cookies -p Auto -e Artwork ``` -------------------------------- ### SmartImage CLI with Piped File Path (Linux) Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage Demonstrates an advanced Linux usage scenario where a file path is stored in a shell variable and then piped to the SmartImage CLI. This example includes reading cookies, setting priority engines, and specifying multiple search engines. ```bash cx1="/home/neorenegade/1654086015521.png" neorenegade@localhost:/mnt/c/Users/Deci/$ echo -nE $cx1 | ./SmartImage --read-cookies -p Auto -e Artwork,Yandex ``` -------------------------------- ### Pipe Binary Image Data for Search (PowerShell) Source: https://context7.com/decimation/smartimage/llms.txt This PowerShell example demonstrates piping binary image data directly to SmartImage. It reads the image file as bytes and then pipes them to the executable for searching, using the SauceNao engine. ```powershell $bytes = [System.IO.File]::ReadAllBytes("image.png") $bytes | ./SmartImage.exe -e SauceNao ``` -------------------------------- ### SmartImage CLI with Piped Image Bytes (Windows PowerShell) Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Usage Presents an advanced Windows PowerShell example where image bytes are read from a file into a variable and then piped to the SmartImage CLI. This showcases reading cookies, setting priority engines, and specifying multiple search engines. ```powershell $cx2=[System.IO.File]::ReadAllBytes($(Resolve-Path "..\..\Pictures\Art\Atago_final_1-3.png")) $cx2|.\SmartImage.exe --read-cookies -p Auto -e Artwork,Yandex ``` -------------------------------- ### Handle Images with UniImage (C#) Source: https://context7.com/decimation/smartimage/llms.txt Explains the UniImage class for unified image handling from files and URLs. It covers creating images, checking types, accessing data, generating perceptual hashes for similarity comparison, and manipulating the underlying ImageSharp image object. It also shows how to get raw bytes, streams, and write URL images to temporary files. ```csharp using SmartImage.Lib.Images.Uni; using SixLabors.ImageSharp; // Create from file path var fileImage = await UniImage.TryCreateAsync("C:/images/photo.png"); // Create from URL var urlImage = await UniImage.TryCreateAsync("https://example.com/image.jpg"); // Check image type Console.WriteLine($"Type: {fileImage.Type}"); // File or Uri Console.WriteLine($"Is File: {fileImage.IsFile}"); Console.WriteLine($"Is URL: {fileImage.IsUri}"); // Access image data Console.WriteLine($"Value: {fileImage.Value}"); Console.WriteLine($"Size: {fileImage.Length} bytes"); Console.WriteLine($"Format: {fileImage.ImageFormat?.Name}"); // Get perceptual hash for similarity comparison Console.WriteLine($"Hash: {fileImage.Hash}"); // Calculate similarity between two images fileImage.CalculateSimilarity(urlImage); Console.WriteLine($"Similarity: {fileImage.Similarity}%"); // Access ImageSharp image for manipulation if (fileImage.HasImage) { Image image = fileImage.Image; Console.WriteLine($"Dimensions: {image.Width}x{image.Height}"); } // Get raw bytes if (fileImage.HasBytes) { byte[] data = fileImage.Bytes; using var stream = fileImage.GetStream(); } // Write to temp file (for URL images) string tempPath = fileImage.WriteImageToFile(); Console.WriteLine($"Temp file: {tempPath}"); fileImage.Dispose(); ``` -------------------------------- ### Execute Reverse Image Search with SearchClient in C# Source: https://context7.com/decimation/smartimage/llms.txt Demonstrates how to use the SearchClient class to perform a reverse image search. It covers configuration, query creation, image uploading, running the search, and processing results. Dependencies include the SmartImage.Lib and SmartImage.Lib.Engines namespaces. ```csharp using SmartImage.Lib; using SmartImage.Lib.Engines; // Create search configuration with specific engines var config = new SearchConfig { SearchEngines = SearchEngineOptions.SauceNao | SearchEngineOptions.Iqdb | SearchEngineOptions.TinEye, PriorityEngines = SearchEngineOptions.Auto, // Auto-open best result UploadEngine = UploadEngineOptions.Catbox }; // Initialize search client using var client = new SearchClient(config); // Create search query from file or URL var query = await SearchQuery.TryCreateAsync("C:/images/sample.png"); // Upload image to temporary host await query.TryUploadAsync(); // Open result channel to receive results as they complete client.OpenChannel(); // Execute search across all selected engines await client.RunSearchAsync(query); // Read results from channel while (await client.ResultChannel.Reader.WaitToReadAsync()) { var result = await client.ResultChannel.Reader.ReadAsync(); Console.WriteLine($"[{result.Engine.Name}] Status: {result.Status}"); foreach (var item in result.Results) { Console.WriteLine($" - {item.Url} (Similarity: {item.Similarity}%)"); Console.WriteLine($" Artist: {item.Artist}, Source: {item.Source}"); } } // Get overall best result var allResults = new List(); var best = SearchClient.GetBest(allResults); Console.WriteLine($"Best match: {best?.Url} at {best?.Similarity}%"); ``` -------------------------------- ### Configure Search Engines with SearchEngineOptions Source: https://context7.com/decimation/smartimage/llms.txt Demonstrates how to use the `SearchEngineOptions` enum in C# to select individual search engines or predefined groups using bitwise flags. It also shows how to check for specific engine flags and retrieve engine instances. ```csharp using SmartImage.Lib.Engines; // Select individual engines var engines = SearchEngineOptions.SauceNao | SearchEngineOptions.Google | SearchEngineOptions.TinEye; // Use preset groups var artworkEngines = SearchEngineOptions.Artwork; // SauceNao | Iqdb | Ascii2D | EHentai var allEngines = SearchEngineOptions.All; // All 16+ engines // Check if specific engine is selected bool hasSauceNao = engines.HasFlag(SearchEngineOptions.SauceNao); // Get engine instances from options var engineInstances = BaseSearchEngine.GetSelectedEngines(engines); ``` -------------------------------- ### Create Image Search Queries with SearchQuery Source: https://context7.com/decimation/smartimage/llms.txt Explains how to create `SearchQuery` objects in C# from local file paths or remote URLs. It covers handling invalid sources, uploading local files to temporary hosting, and accessing image data and upload status. ```csharp using SmartImage.Lib; using SmartImage.Lib.Engines.Upload; // Create query from local file var fileQuery = await SearchQuery.TryCreateAsync("C:/images/artwork.png"); // Create query from URL (no upload needed) var urlQuery = await SearchQuery.TryCreateAsync("https://i.imgur.com/example.jpg"); // Check query validity if (fileQuery == SearchQuery.Null) { Console.WriteLine("Invalid image source"); return; } // Upload local file to temporary host var uploadEngine = BaseUploadEngine.GetUploadEngine(UploadEngineOptions.Catbox); bool uploaded = await fileQuery.TryUploadAsync(uploadEngine); Console.WriteLine($"Query: {fileQuery.Source}"); Console.WriteLine($"Uploaded: {fileQuery.IsUploaded}"); Console.WriteLine($"Upload URL: {fileQuery.Upload?.Url}"); // Access underlying image data var image = fileQuery.Source; Console.WriteLine($"Image type: {image.Type}"); Console.WriteLine($"Image size: {image.Length} bytes"); Console.WriteLine($"Image format: {image.ImageFormat?.Name}"); // Clean up fileQuery.Dispose(); ``` -------------------------------- ### Upload Images with BaseUploadEngine (C#) Source: https://context7.com/decimation/smartimage/llms.txt Illustrates the use of BaseUploadEngine for uploading local image files to temporary hosting services like Catbox, Litterbox, and Pomf. It covers obtaining engine instances, uploading files, and setting a default engine for SearchQuery. The maximum file size varies per engine. ```csharp using SmartImage.Lib.Engines.Upload; using SmartImage.Lib.Images.Uni; // Get upload engine instance var catbox = BaseUploadEngine.GetUploadEngine(UploadEngineOptions.Catbox); var litterbox = BaseUploadEngine.GetUploadEngine(UploadEngineOptions.Litterbox); var pomf = BaseUploadEngine.GetUploadEngine(UploadEngineOptions.Pomf); // Upload a file var image = await UniImage.TryCreateAsync("C:/images/photo.jpg"); var uploadResult = await catbox.UploadFileAsync(image.Value); Console.WriteLine($"Upload URL: {uploadResult.Url}"); Console.WriteLine($"File size: {uploadResult.Size} bytes"); // Set default upload engine BaseUploadEngine.Default = catbox; // Upload via SearchQuery (uses default engine) var query = await SearchQuery.TryCreateAsync("C:/images/photo.jpg"); await query.TryUploadAsync(); // Uses BaseUploadEngine.Default // Or specify engine explicitly await query.TryUploadAsync(litterbox); // Max file size varies by engine Console.WriteLine($"Catbox max size: {catbox.MaxLength} bytes"); catbox.Dispose(); ``` -------------------------------- ### Search Artwork with SauceNaoEngine (C#) Source: https://context7.com/decimation/smartimage/llms.txt Demonstrates how to use the SauceNaoEngine for searching anime/manga artwork. It shows authentication with an API key and parsing detailed search results, including artist, source, and character information. Higher rate limits and more detailed results are available with API key usage. ```csharp using SmartImage.Lib; using SmartImage.Lib.Engines.Search; // Using SauceNao with API key var sauceNao = new SauceNaoEngine("your-api-key-here"); // Or configure via SearchConfig var config = new SearchConfig { SauceNaoKey = "your-api-key-here", SearchEngines = SearchEngineOptions.SauceNao }; // Execute search var query = await SearchQuery.TryCreateAsync("https://example.com/anime-art.jpg"); await query.TryUploadAsync(); var result = await sauceNao.GetResultAsync(query); // SauceNao results include site index information foreach (var item in result.Results) { if (item is SauceNaoResultItem sauceItem) { Console.WriteLine($"Index: {sauceItem.Index}"); // Pixiv, Danbooru, etc. Console.WriteLine($"URLs: {string.Join(", ", sauceItem.Urls ?? Array.Empty())}"); } Console.WriteLine($"Similarity: {item.Similarity}%"); Console.WriteLine($"Artist: {item.Artist}"); Console.WriteLine($"Source: {item.Source}"); Console.WriteLine($"Character: {item.Character}"); } // API usage provides: // - Higher daily search limits (vs 50 for unregistered) // - More detailed results // - No CAPTCHA challenges sauceNao.Dispose(); ``` -------------------------------- ### SmartImage GUI Auto-Start Search (Windows) Source: https://context7.com/decimation/smartimage/llms.txt This command enables the auto-start search feature in the SmartImage GUI application, initiating the search immediately after loading the specified input image. ```bash SmartImage.exe -i "C:\images\photo.png" -auto ``` -------------------------------- ### SmartImage GUI Switch Input Queue (Windows) Source: https://context7.com/decimation/smartimage/llms.txt This command instructs the SmartImage GUI application to switch to a new input image within an existing queue, useful for managing multiple image searches. ```bash SmartImage.exe -i "C:\images\new.png" -s ``` -------------------------------- ### SmartImage Server Host Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Server Host a listen server for SmartImage. This endpoint accepts an image URI and can handle binary image uploads. ```APIDOC ## POST /decimation/smartimage/server ### Description Hosts a listen server for SmartImage using the `server` command. Accepts an image URI as the body or a multipart/form-data binary image. ### Method POST ### Endpoint /decimation/smartimage/server ### Parameters #### Query Parameters - **file** (string) - Required - The path to the image file. #### Request Body - **imageUri** (string) - Optional - The URI of the image. #### Form Data - **file** (binary) - Optional - A binary image file. ### Request Example (PowerShell) ```pwsh $x = iwr 'http://localhost:25565/search' -Form @{file=get-item ""} if ($$) { $y = $x.Content | ConvertFrom-Json Start-Process $y.Best.Url } $y ``` ### Response #### Success Response (200) - **best** (object) - Contains information about the best match. - **url** (string) - The URL of the best matching image. #### Response Example ```json { "best": { "url": "http://example.com/image.jpg" } } ``` ``` -------------------------------- ### Configure SmartImage Search Settings in C# Source: https://context7.com/decimation/smartimage/llms.txt Illustrates how to configure the SearchConfig class for reverse image searches. This includes selecting search engines, setting priority engines, configuring upload services, API keys, and advanced options like cookie reading and FlareSolverr integration. The configuration can be saved to a file. ```csharp using SmartImage.Lib; using SmartImage.Lib.Engines; using SmartImage.Lib.Engines.Upload; // Create configuration with all options var config = new SearchConfig { // Select which engines to search SearchEngines = SearchEngineOptions.All, // Which engine results should auto-open in browser PriorityEngines = SearchEngineOptions.SauceNao, // Upload service for local files UploadEngine = UploadEngineOptions.Catbox, // SauceNao API key for higher rate limits SauceNaoKey = "your-api-key-here", // Read browser cookies for authenticated searches ReadCookies = true, // Use FlareSolverr for Cloudflare bypass FlareSolverr = true, FlareSolverrApiUrl = "http://localhost:8191/v1", // Open raw search URL instead of best result OpenRaw = false, // Auto-detect clipboard changes Clipboard = true, // Start search automatically on input AutoSearch = true }; // Save configuration to disk config.Save(); // Use preset engine groups config.SearchEngines = SearchEngineOptions.Artwork; // SauceNao, Iqdb, Ascii2D, EHentai config.SearchEngines = SearchEngineOptions.Advanced; // All except basic engines ``` -------------------------------- ### Interact with SmartImage Server using PowerShell Source: https://github.com/decimation/smartimage/wiki/(Rdx)-Server This PowerShell script demonstrates how to send an image to the SmartImage server for processing and then open the best result. It sends a multipart/form-data request with the image file and parses the JSON response to open the best image URL. ```pwsh $x = iwr 'http://localhost:25565/search' -Form @{file=get-item ""} if ($$) { $y = $x.Content | ConvertFrom-Json Start-Process $y.Best.Url } $y ``` -------------------------------- ### Process Search Results with SearchResult and SearchResultItem Source: https://context7.com/decimation/smartimage/llms.txt Details how to process search results in C# using `SearchResult` and `SearchResultItem`. It covers checking search status, retrieving the best match, iterating through all results, and accessing metadata like URLs, similarity, and artist information. ```csharp using SmartImage.Lib.Engines.Results; // Processing search results void ProcessResults(SearchResult result) { Console.WriteLine($"Engine: {result.Engine.Name}"); Console.WriteLine($"Status: {result.Status}"); Console.WriteLine($"Raw URL: {result.RawUrl}"); if (result.Status == SearchResultStatus.Cooldown) { Console.WriteLine($"Error: {result.ErrorMessage}"); return; } if (!result.HasResults) { Console.WriteLine("No results found"); return; } // Get best result by similarity var best = result.GetBestResult(); if (best != null) { Console.WriteLine($"Best match: {best.Url}"); Console.WriteLine($"Similarity: {best.Similarity}%"); } // Iterate all results foreach (var item in result.Results.Where(r => !r.IsRaw)) { Console.WriteLine($"\n--- Result ---"); Console.WriteLine($"URL: {item.Url}"); Console.WriteLine($"Similarity: {item.Similarity}%"); Console.WriteLine($"Site: {item.Site}"); Console.WriteLine($"Artist: {item.Artist}"); Console.WriteLine($"Source: {item.Source}"); Console.WriteLine($"Title: {item.Title}"); Console.WriteLine($"Character: {item.Character}"); Console.WriteLine($"Dimensions: {item.Width}x{item.Height}"); Console.WriteLine($"Thumbnail: {item.Thumbnail}"); Console.WriteLine($"Score: {item.Score}"); // Load thumbnail image await item.LoadThumbnailAsync(); if (item.HasThumbnail) { // item.ThumbnailImage contains ImageSharp image } // Scan for additional URLs in page await item.ScanAsync(); foreach (var scanned in item.ScannedItems) { Console.WriteLine($" Scanned: {scanned.Url}"); } } } ``` -------------------------------- ### Execute Command After Search Source: https://context7.com/decimation/smartimage/llms.txt This command configures SmartImage to execute a specified command and its arguments after the search operation is completed. This is useful for automating post-search actions. ```bash ./SmartImage "image.png" --cmd-exe "notify-send" --cmd-args "Search complete" ``` -------------------------------- ### SmartImage GUI Hidden Mode (Windows) Source: https://context7.com/decimation/smartimage/llms.txt This command launches the SmartImage GUI application in hidden mode, meaning no GUI window will be displayed. It also enables auto-start search. ```bash SmartImage.exe -i "C:\images\photo.png" -auto -h ``` -------------------------------- ### Output Specific Fields to CSV Source: https://context7.com/decimation/smartimage/llms.txt This command demonstrates how to specify which fields to output from the SmartImage search results into a CSV file. The available fields include Name, Url, Similarity, and Artist. ```bash ./SmartImage "image.png" -o results.csv --output-fields Name,Url,Similarity,Artist ``` -------------------------------- ### Bypass Cloudflare with FlareSolverr Source: https://context7.com/decimation/smartimage/llms.txt This command uses the SmartImage tool to bypass Cloudflare protection by leveraging FlareSolverr. It requires the path to the image file and the FlareSolverr API endpoint. ```bash ./SmartImage "image.png" --flaresolverr --flaresolverr-api "http://localhost:8191/v1" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.