mirror of
https://github.com/Phantop/dotfiles
synced 2024-12-27 23:46:42 +00:00
28 lines
494 B
Plaintext
28 lines
494 B
Plaintext
|
#!/usr/bin/fish
|
||
|
set offset 0
|
||
|
set 1 $argv[1]
|
||
|
set 2 $argv[2]
|
||
|
if test $argv[3]
|
||
|
set offset $argv[3]
|
||
|
end
|
||
|
|
||
|
set h1 (identify -format %h "$1")
|
||
|
set h2 (identify -format %h "$2")
|
||
|
|
||
|
if test $h1 -ne $h2
|
||
|
exit
|
||
|
end
|
||
|
|
||
|
|
||
|
set w1 (identify -format %w "$1")
|
||
|
set w2 (identify -format %w "$2")
|
||
|
set drop (math $w1+$offset)
|
||
|
set width (math $drop+$w2)
|
||
|
|
||
|
set out "$(dirname "$1")/tran_$(basename "$1")"
|
||
|
set work (mktemp)
|
||
|
|
||
|
jpegtran -outfile $work -crop $width $1
|
||
|
jpegtran -outfile $out -drop +$drop $2 $work
|
||
|
rm $work
|