https://github.com/junian/sharpexiftool
ExifTool CLI Wrapper in C#. Tested on Windows and macOS.
https://github.com/junian/sharpexiftool
csharp dotnet exif exiftool linux macos metadata windows
Last synced: 6 months ago
JSON representation
ExifTool CLI Wrapper in C#. Tested on Windows and macOS.
- Host: GitHub
- URL: https://github.com/junian/sharpexiftool
- Owner: junian
- License: mit
- Created: 2024-05-10T06:42:11.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-06T03:18:54.000Z (over 1 year ago)
- Last Synced: 2025-06-10T00:05:36.083Z (about 1 year ago)
- Topics: csharp, dotnet, exif, exiftool, linux, macos, metadata, windows
- Language: C#
- Homepage: https://www.junian.dev/SharpExifTool/
- Size: 318 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: docs/README.md
- License: LICENSE
Awesome Lists containing this project
README

SharpExifTool
C# Wrapper for ExifTool by Phil Harvey. Available for Windows, macOS, and Linux.
----
## Installation
Get [SharpExifTool](https://www.nuget.org/packages/SharpExifTool/) from NuGet.
```shell
dotnet add package SharpExifTool
```
## Usage
### Init
You can create an exiftool instance by using the built-in `exiftool` binary.
```csharp
using(var exiftool = new SharpExifTool.ExifTool())
{
// Do something here
}
```
### Read All EXIF / Metadata Tags
```csharp
using(var exiftool = new SharpExifTool.ExifTool())
{
await exiftool.ExtractAllMetadataAsync(filename: "image.jpg");
}
```
### Write EXIF / Metadata Tags
```csharp
using(var exiftool = new SharpExifTool.ExifTool())
{
await exiftool.WriteTagsAsync(
filename: "image.jpg",
properties: new Dictionary
{
["artist"] = ["Phil Harvey"],
});
}
```
### Remove All Safe EXIF / Metadata Tags
```csharp
using(var exiftool = new SharpExifTool.ExifTool())
{
await exiftool.RemoveAllMetadataAsync(filename: "image.jpg");
}
```
### Custom Command
For example, you want to execute the following in the command line:
```shell
exiftool -artist="Phil Harvey" -copyright="2011 Phil Harvey" a.jpg
```
You can do it like this in C#:
```csharp
using(var exiftool = new SharpExifTool.ExifTool())
{
await exiftool.ExecuteAsync(
"-artist=\"Phil Harvey\"",
"-copyright=\"2011 Phil Harvey\"",
"a.jpg");
}
```
## Development
Before starting development, install 3rd party dependencies by executing `getlibs.sh` (it'll only work on macOS or Unix operating system, no Windows script for now).
```bash
$ ./getlibs.sh
```
This will download and extract files based on `.gitbinmodules` content and place them under the `libs` directory.
To use a different version of `exiftool`, you can edit the `.gitbinmodules` file and change it with your desired version.
You can also download from [official website](https://exiftool.org) and extract the files manually. Put them in the `libs` directory so it'll look something like this:
```shell
.
├── docs
│ └── README.md
├── libs
│ ├── ExifTool.Unix
│ │ ├── Makefile.PL
│ │ ├── arg_files
│ │ ├── build_geolocation
│ │ ├── config_files
│ │ ├── exiftool
│ │ ├── fmt_files
│ │ ├── lib
│ │ ├── perl-Image-ExifTool.spec
│ │ └── t
│ └── ExifTool.Win
│ └── exiftool.exe
└── src
```
## Credits
- [ExifTool](https://exiftool.org) by Phil Harvey.
- [FileMeta/ExifToolWrapper](https://github.com/FileMeta/ExifToolWrapper): CodeBit: C# Wrapper for Phil Harvey's ExifTool
## License
- This [SharpExifTool](https://github.com/junian/SharpExifTool) project is licensed under [MIT License](https://github.com/junian/SharpExifTool/blob/master/LICENSE).
- The [ExifTool](https://exiftool.org/#license) is free software; you can redistribute it and/or modify it under the same terms as [Perl itself](https://dev.perl.org/licenses/).
---
Made with ☕ by [Junian.dev](https://www.junian.dev).