Created
April 26, 2024 14:33
-
-
Save vnphanquang/c1ff4c8346ccd131e530786511fd1da2 to your computer and use it in GitHub Desktop.
crop-images.fish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
set --local count $argv[1] | |
set --local percentage $(math 100 / $count) | |
for i in (seq 0 $(math $count - 1)) | |
set --local offset $(math $percentage / 100 \* $i) | |
magick image.png -gravity North -crop "100%x$percentage%+0+%[fx:h*$offset]" "cropped-$i".jpg | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment