Skip to content

Instantly share code, notes, and snippets.

@dagezi
Created December 23, 2014 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagezi/194c9972ca5ca36dd2db to your computer and use it in GitHub Desktop.
Save dagezi/194c9972ca5ca36dd2db to your computer and use it in GitHub Desktop.
Generate debug icons with batch.
#!/bin/bash
# all coordinate specified by percentage
x=75
y=75
w=12
h=12
color=yellow
icons=`cd src/main;echo res/*-*dpi/ic_launcher.png`
for icon in $icons
do
size=`identify src/main/$icon |sed 's/.*[0-9]x\([0-9][0-9]*\).*/\1/'`
x0=$(( $size * $x / 100 ))
y0=$(( $size * $y / 100))
x1=$(( $size * ( $x + $w ) / 100))
y1=$(( $size * ( $y + $h ) / 100))
mkdir -p src/debug/$icon:h
convert src/main/$icon -fill $color -draw "rectangle $x0,$y0 $x1,$y1" src/debug/$icon
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment