A command-line interface (CLI) application that extracts metadata from image files.
This tool is designed for developers who need to quickly access metadata from images in various formats.
- Extracts metadata from single image or all images in a specified directory (also recursively).
- Outputs the extracted metadata to console as JSON or saves it to a JSON file.
- Supports various image formats.
- Programming Language: C#
- Framework: .NET 8.0
- Metadata Extraction Library: MetadataExtractor
- JSON Serialization: System.Text.Json (part of .NET)
- Download the latest release from the Releases page.
You need to have .NET 8.0 installed on your machine if you want to useno-runtime
version. - Extract executable file from the downloaded archive.
- Navigate to the directory where you extracted the files.
- Run the following command to get list of available commands:
extractor -h
- Single Image: Extract metadata from a single image file.
extractor <file-path>
- Directory: Extract metadata from all images in a specified directory.
extractor -d <directory-path>
- Directory Recursive: Extract metadata from all images in a specified directory and all subdirectories.
extractor -d <directory-path> -r
- Output to File: Save the extracted metadata to a JSON file.
extractor <file-path> -o <output-file>
These options are experimental and might not work as expected. Pretty sure they will be changed or removed in future versions. Combining them together might not work.
- Filter Tag Name: Return metadata with specific tag name. Ignore all other tags.
extractor -d <directory-path> -t <tag-name>
- Search in Tag Description: Return metadata with description containing specific string. Ignore all other tags. Using Regex is possible, but might not work as expected. Something like
-s '[\d\w]{10}'
should work.
extractor -d <directory-path> -s <search-string>
- Prerequisites: Ensure you have the .NET SDK (version 8.0 or higher) installed on your machine. You can download it from the official .NET website. You can check your current version by running the following command:
dotnet --version
- Clone the Repository:
git clone https://github.com/Avaray/image-metadata-extractor-cli.git
cd image-metadata-extractor-cli
- Run the Application:
dotnet run
- Build the Application:
dotnet build
I created this project because I needed a tool like this. I will use it in my other project where I need to extract metadata from images. Normally I don't code in C# but with help of Claude and Perplexity it was pretty easy 👌
Creating a working CLI took me a little over an hour. However, messing around with configuring GitHub Actions for Releases drove me crazy. But finally, I got it working 🎉
I might add more features in the future. I'm considering following changes:
- Add recursive metadata extraction
-r
option. - Add checks for invalid file types.
- Possibility to filter images by "Tag Name".
- Possibility to filter images by searching in "Tag Description"
- Lower the required .NET version. Not sure how low I can go.