add two image convert functions
This commit is contained in:
parent
338910468a
commit
0eaf3cb322
1 changed files with 19 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
flac
|
||||
unzip
|
||||
p7zip
|
||||
imagemagick
|
||||
];
|
||||
|
||||
programs.zsh.initContent = ''
|
||||
|
|
@ -54,6 +55,24 @@
|
|||
shnsplit -f "$cue" -t "%n - %t" -o "$fmt" -d ./tracks "$audio"
|
||||
}
|
||||
|
||||
function image2webp() {
|
||||
local dir="''${1:-.}"
|
||||
find "$dir" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \) | while read -r img; do
|
||||
outfile="''${img%.*}.webp"
|
||||
${pkgs.imagemagick}/bin/magick "$img" -resize '1800>' -quality 82 "$outfile"
|
||||
echo "Converted: $img -> $outfile"
|
||||
done
|
||||
}
|
||||
|
||||
function webp2png() {
|
||||
local dir="''${1:-.}"
|
||||
find "$dir" -type f -iname '*.webp' | while read -r img; do
|
||||
outfile="''${img%.*}.png"
|
||||
${pkgs.imagemagick}/bin/magick "$img" "$outfile"
|
||||
echo "Converted: $img -> $outfile"
|
||||
done
|
||||
}
|
||||
|
||||
function camera-copy() {
|
||||
local delete_source=0
|
||||
if [[ "$1" == "-d" || "$1" == "--delete" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue