Last active
January 1, 2023 15:59
-
-
Save metaphore/9a2ac696854628470b6a0cba5549e7b0 to your computer and use it in GitHub Desktop.
Gnome | Aseprite thumbnail generator
This file contains hidden or 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
| #!/usr/bin/sh | |
| if [ $# -ge 2 -a $# -lt 4 ]; then | |
| mkdir -p /tmp/Aseprite | |
| filename="$(mktemp -d -p /tmp/Aseprite/).png" | |
| if [ $# -eq 2 ]; then | |
| aseprite -b --frame-range "0,0" $1 --trim --sheet $filename | |
| elif [ $# -eq 3 ]; then | |
| aseprite -b --frame-range "0,0" $1 --shrink-to "$3,$3" --trim --sheet $filename | |
| fi | |
| test="/home/metaphore/Desktop/tmp-icon/output.png" | |
| mkdir -p $(dirname "$2"); mv $filename $2; | |
| convert -colorspace sRGB $2 -background transparent -flatten -filter Point -thumbnail $3x$3 -gravity center -extent $3x$3 png32:$2 | |
| else | |
| echo "Parameters for aseprite thumbnailer are: inputfile outputfile [size]" | |
| fi |
This file contains hidden or 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
| [Thumbnailer Entry] | |
| TryExec=aseprite-thumbnailer | |
| Exec=aseprite-thumbnailer %i %o %s | |
| MimeType=image/x-aseprite |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> | |
| <mime-type type="image/x-aseprite"> | |
| <comment xml:lang="en">Aseprite Pixel Art</comment> | |
| <magic priority="50"> | |
| <match type="little16" value="0xA5E0" offset="4"/> | |
| </magic> | |
| <glob pattern="*.ase"/> | |
| <glob pattern="*.aseprite"/> | |
| <icon name="aseprite"/> | |
| </mime-type> | |
| </mime-info> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pre-requirements:
asepriteexecutable should be available from the PATH.convertshould be available from the PATH.Installation:
update-mime-database aseprite.xml.aseprite-thumbnailerto/usr/bin/aseprite-thumbnailer(don't forget to make it executable).aseprite.thumbnailerto~/.local/share/thumbnailers/aseprite.thumbnailerrm -r ~/.cache/thumbnails/failedP.S. Tested with Pop!_OS Gnome 42