Skip to content

Instantly share code, notes, and snippets.

@mitjafelicijan
Last active May 6, 2023 23:56
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 mitjafelicijan/4835707971ef26dbbbdca7f2e5b04bc7 to your computer and use it in GitHub Desktop.
Save mitjafelicijan/4835707971ef26dbbbdca7f2e5b04bc7 to your computer and use it in GitHub Desktop.
Converts WoW TGA screenshots to PNG after Lutris is closed
#!/usr/bin/env bash
# Instructions
# - Copy contents of this script to a file `wowtga2png.sh`.
# - Make the script executable with `chmod +x wowtga2png.sh`.
# - Check that the paths of WOW_DIR and OUT_DIR are correct and use absolute paths for directories.
# - In Lutris:
# - Click on the game and select "Configure".
# - Toggle "Advance" in the dialog that just popped up.
# - Go to "System Options" tab and scroll down to "Post-exit script".
# - "Browse" and locate your script.
# - Save and when you will exit Lutris screenshots will be converted to the format of your choosing.
# Set the WoW Screenshot directory and OUTPUT directory.
WOW_DIR=/home/m/Games/Turtle/Screenshots
OUT_DIR=/home/m/Pictures/WoW
OUT_FORMAT=png # Should be a valid extension (png, jpg, bmp)
# check if there are any tga files in the TGA directory
if [ ! -e "$WOW_DIR"/*.tga ]; then
echo "No TGA files found in $WOW_DIR."
exit 1
fi
# Loop through all WoW tga files in the Screenshots directory.
for file in "$WOW_DIR"/*.tga; do
# Get the filename without extension.
filename=$(basename "$file" .tga)
# Check if a corresponding file exists in the OUT directory.
if [ -e "$OUT_DIR/$filename.png" ]; then
echo "Skipping $filename.tga: $filename.$OUT_FORMAT already exists in $OUT_DIR."
else
# Convert WoW TGA Screenshot to OUT format and save in the OUT directory.
convert "$file" "$OUT_DIR/$filename.$OUT_FORMAT"
echo "Converted $filename.tga to $filename.$OUT_FORMAT and saved in $OUT_DIR."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment