-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate-linux
More file actions
executable file
·42 lines (36 loc) · 1.13 KB
/
Copy pathactivate-linux
File metadata and controls
executable file
·42 lines (36 loc) · 1.13 KB
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
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# Get the height of the input image
height=$(magick identify -format "%h" "$1")
# Calculate 10% of the height
watermark_height=$(( height / 15 ))
svg_height=25
watermark_svg() {
cat << EOF
<svg viewBox="0 0 88 ${svg_height}" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="s">
<feOffset dx="1" dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .70 0"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<g filter="url(#s)" fill="#fff" fill-opacity=".36" font-family="sans-serif" transform="translate(2.4 3.5)">
<text y="0" font-size="7" dominant-baseline="hanging">Activate Linux</text>
<text y="8" font-size="5" dominant-baseline="hanging">Go to Settings to activate Linux.</text>
</g>
</svg>
EOF
}
density=$(( (watermark_height * 72) / svg_height ))
outfile=`mktemp`
magick "$1" \
'(' -background none -density ${density} <(watermark_svg) -resize x${watermark_height} ')' \
-gravity southeast \
-geometry +20+100 \
-composite \
$outfile
echo $outfile