https://github.com/carloe/duotone-swift
Apply duotone effects to images from the cli using GPU acceleration.
https://github.com/carloe/duotone-swift
command-line duotone image-processing macos metal shaders swift
Last synced: 8 months ago
JSON representation
Apply duotone effects to images from the cli using GPU acceleration.
- Host: GitHub
- URL: https://github.com/carloe/duotone-swift
- Owner: carloe
- License: mit
- Created: 2020-06-16T16:07:48.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-12T22:51:12.000Z (over 1 year ago)
- Last Synced: 2025-02-12T23:30:31.508Z (over 1 year ago)
- Topics: command-line, duotone, image-processing, macos, metal, shaders, swift
- Language: Swift
- Homepage:
- Size: 191 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DUOTONE
Apply [duotone](https://en.wikipedia.org/wiki/Duotone) effects to images using GPU acceleration. Thanks to the use of Metal it's on average 75 times faster than the original [Python version](https://github.com/carloe/duotone-py).

## Install
```bash
git clone git@github.com:carloe/duotone-swift.git
cd duotone
swift package update
swift build -c release
cp -f .build/release/duotone /usr/local/bin/duotone
duotone --help
```
## Usage
Duotone individual files or batch process entire folders.
```bash
# Single Image...
duotone input.jpg --light '#FFCB00' --dark '#38046C' --out output.png
# Batch processing...
duotone ~/images --light '#FFCB00' --dark '#38046C' --out ~/images/out
```
## Presets
Settings can be saved as preset so they can be reused without having to juggle or memorize hex colors.
```bash
# List all presets
duotone list
# Add a new preset named 'foo'
duotone add --preset foo --light '#FFCB00' --dark '#38046C' --contrast 0.5 --blend 0.5
# Remove the preset named foo
duotone remove --preset foo
# Apply the preset 'foo' to 'file.jpg'
duotone file.jpg --preset foo --out result.jpg
```
Presets are saved as JSON, and can also be eddited directly.
```bash
vim ~/.duotone
```
```json
[
{
"blend" : 1,
"light" : "#444644",
"dark" : "#1e201e",
"contrast" : 0.5,
"name" : "spacegray"
}
]
```
## License
MIT