Created
February 8, 2010 08:53
-
-
Save silvioq/297997 to your computer and use it in GitHub Desktop.
Colorizar las imágenes de un directorio
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 | |
DIR=../../it/css | |
for cssfile in $DIR/*.css; do | |
echo $cssfile ../css/`basename $cssfile` | |
cat $cssfile | ruby redize.rb 45 > ../css/`basename $cssfile` | |
done; |
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
def redize(color) | |
`convert xc:#{color} -crop 1x1+0+0 -fill red -tint #{$TINT} -alpha off -depth 8 txt:- | sed -n 's/.* \\(#.*\\)/\\1/p' | cut -b 1-7`.strip | |
end | |
$TINT=ARGV[0] || 35 | |
$stdin.each{ |line| | |
line.gsub!( /#[0-9a-fA-F]{6}/ ){ |color| | |
redize(color) | |
} | |
puts line | |
} | |
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 | |
DIR=../../it/images | |
for file in $DIR/*.png $DIR/*.jpg $DIR/*.gif; do | |
convert $file -fill red -tint 35 `basename $file` | |
done; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment