Created
April 24, 2015 11:50
-
-
Save cimmwolf/0f660d4d160ff3159714 to your computer and use it in GitHub Desktop.
[EN] Bash-script which can trim images with noise or artifacts. Requires ImageMagick. [RU] Bash-скрипт, который может обрезать пустые края у изображений даже при наличии на них шума и небольших артефактов. Требуется ImageMagick
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
#!/bin/bash | |
### setting | |
blur="0x15" | |
fuzz="15%" | |
nof=`ls -l *.jpg | wc -l` | |
i=1 | |
echo -n " start trimming..." | |
for f in *.jpg | |
do | |
trim=`convert "$f" -virtual-pixel edge -blur "$blur" -fuzz "$fuzz" -trim -format '%wx%h%O' info:` | |
convert "$f" -crop "$trim" +repage "$f" | |
echo -ne \\r" complete: $i/$nof ($f)" | |
((i++)) | |
done | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment