Created
July 19, 2024 12:53
-
-
Save tkafka/24b2c3f5ccb874517b3b3c71e1123dbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Directory of PNG images to process | |
DIRECTORY="./fastlane/screenshots" | |
# Check if mogrify command is available | |
if ! command -v mogrify &>/dev/null; then | |
echo "mogrify could not be found. Please install ImageMagick (brew install imagemagick)." | |
exit 1 | |
fi | |
# Loop through all PNG images in the specified directory | |
find "$DIRECTORY" -type f -name '*.png' ! -type l | while read -r image; do | |
echo "Removing transparency from $image ..." | |
# Remove transparency by setting a black background and then flattening the image | |
mogrify -format png -background black -alpha remove -alpha off "$image" | |
done | |
echo "All images processed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment