Skip to content

Instantly share code, notes, and snippets.

@ajashton
Created September 20, 2010 15:18
Show Gist options
  • Save ajashton/588052 to your computer and use it in GitHub Desktop.
Save ajashton/588052 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Applies a greyscale image as the alpha channel to another image.
# Black will be transparent, white will be opaque.
# Useful for tilesets, ie: find . -name "*.png" -exec alphafy.sh {} \;
tile=$1
fill_tile=/mnt/white.png
echo "Tile: $tile"
mv "$tile" "$tile.bak" && \
composite -compose CopyOpacity "$tile.bak" "$fill_tile" "$tile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment