Skip to content

Instantly share code, notes, and snippets.

@silvioq
Created February 8, 2010 08:53
Show Gist options
  • Save silvioq/297997 to your computer and use it in GitHub Desktop.
Save silvioq/297997 to your computer and use it in GitHub Desktop.
Colorizar las imágenes de un directorio
#!/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;
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
}
#!/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