You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
638 B
Plaintext
26 lines
638 B
Plaintext
#!/bin/env nu
|
|
|
|
export def main [] {
|
|
error make {msg: "missing subcommand"}
|
|
}
|
|
|
|
export def `main add-frame` [src: string, dst: string] {
|
|
try {
|
|
let avg = ( convert $src -resize 1x1! -format "%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]" info:- )
|
|
( magick $src
|
|
-bordercolor white
|
|
-border 100x100
|
|
-bordercolor $"srgb\(($avg)\)"
|
|
-border 5%x5%
|
|
-set option:wd "%[fx:(16/9)>(w/h)?(16/9*h):w]"
|
|
-set option:ht "%[fx:(16/9)>(w/h)?h:(w/(16/9))]"
|
|
-background $"srgb\(($avg)\)"
|
|
-gravity center
|
|
-extent "%[wd]x%[ht]"
|
|
$dst
|
|
)
|
|
} catch {|e|
|
|
print -e $e
|
|
}
|
|
}
|