-
Notifications
You must be signed in to change notification settings - Fork 0
/
photo-splitfreq.sh
executable file
·34 lines (26 loc) · 1.25 KB
/
photo-splitfreq.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -u -e
# help for convert:
# convert gradient_dst.png gradient_src.png \
# -compose Mathematics -define compose:args='1,0,0,0' -composite \
# mathematics_multiply.png
# The four arguments, "A", "B", "C", and "D", define the formula...
# A*Sc*Dc + B*Sc + C*Dc + D
# where "Sc" is the source or overlay image, and "Dc" is the background or destination image.
# high = original - low + 0.5
# recom = low + high - 0.5
# = low + original - low + 0.5 - 0.5
# = original
original=${1:?Need to specify an input file}
imagename=${original%.*}
ext=${original##.*}
# Generate a PSD file with Low, High Frequency and Original Layers
convert "$original" -set label 'input' -alpha off -background none \
\( +clone -set label 'copy' \) \
\( +clone -blur 0x12 -set label 'LF' \) \
\( -clone 1,2 -compose mathematics -set option:compose:args "0,-1,1,0.5" -composite -set label 'HF' \) \
\( -clone 1 -set label 'original' \) \
-delete 0 -alpha Off "$imagename.psd"
# Copy exif data from the original file to the psd
exiftool -tagsFromFile "$original" -Make -Model -Artist -ExposureTime -FNumber -ISO -DateTimeOriginal -FocusMode -FlashMode -Orientation -overwrite_original "$imagename.psd"
echo "$imagename.psd"