Skip to content

Instantly share code, notes, and snippets.

@a1batross
Created April 16, 2019 21:57
Show Gist options
  • Save a1batross/36469abbc5f9d4fb0e3335f6a438d9a2 to your computer and use it in GitHub Desktop.
Save a1batross/36469abbc5f9d4fb0e3335f6a438d9a2 to your computer and use it in GitHub Desktop.
HL Steam backgrounds generator based on imagemagick
#!/bin/bash
file=$1
width=$(identify -format %W $file)
height=$(identify -format %H $file)
out=BackgroundLayout.txt
mkdir -p background
echo "resolution $width $height" >> $out
convert -crop 256x256 $file +repage background/tile%d.tga
num=0
for i in $(seq 0 256 $((height-1)))
do
for j in $(seq 0 256 $((width-1)))
do
echo "resource/background/tile$num.tga scaled $j $i" >> $out
num=$((num+1))
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment