feat: Add fish script to resize JPG images using ImageMagick
This commit is contained in:
parent
28a345c46b
commit
c01c362e3b
1 changed files with 16 additions and 0 deletions
16
home/modules/fish/functions/resize_images.fish
Normal file
16
home/modules/fish/functions/resize_images.fish
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
function resize_images --description "Resize all JPG images in current directory and subdirectories to 40% of original size"
|
||||||
|
if not command -q convert
|
||||||
|
echo "Error: ImageMagick is not installed. Please install it first."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
for img in (find . -type f -name "*.JPG")
|
||||||
|
set original_size (stat -f %z "$img")
|
||||||
|
convert "$img" -resize 40% "$img"
|
||||||
|
set new_size (stat -f %z "$img")
|
||||||
|
echo "Processed $img"
|
||||||
|
echo "Original size: $original_size bytes"
|
||||||
|
echo "New size: $new_size bytes"
|
||||||
|
echo "---"
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue