Skip to content

Instantly share code, notes, and snippets.

@unresolvedsymbol
Last active January 16, 2021 21:58
Show Gist options
  • Save unresolvedsymbol/3a7960e7a9404b6f04070b9a2250c4d4 to your computer and use it in GitHub Desktop.
Save unresolvedsymbol/3a7960e7a9404b6f04070b9a2250c4d4 to your computer and use it in GitHub Desktop.
Generate PS4 avatar files with ImageMagick
#!/bin/sh
! [ "$1" ] || ! [ -e $1 ] && {
echo "Usage: $(basename $0) [avatar image]"
exit 1
}
echo 'Generating resized assets'
convert "$1" -geometry 64x64\! avatar.png
cp avatar.png picture.png
for x in 64 128 260 440; do
convert "$1" -geometry ${x}x${x}\! avatar${x}.dds
cp avatar${x}.dds picture${x}.dds
done
echo 'Enter info for dummy online.json'
read -p 'First name: ' first
read -p 'Last name: ' last
echo -n '{"avatarUrl":"","firstName":"'$first'","lastName":"'$last'","pictureUrl":"","trophySummary":"{\"level\":1,\"progress\":0,\"earnedTrophies\":{\"platinum\":0,\"gold\":0,\"silver\":0,\"bronze\":0}}","isOfficiallyVerified":"true"}' > online.json
echo -n '{"cacheVersion":"5"}' > version.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment