A python tool for decompiling and recompiling Quake sprites.
Decompile sprite: sprconv sprite.spr
Compile sprite: sprconv sprite.json
Use in other scripts:
from sprconv import sprite_from_json
from sprconv import json_from_sprite
sprite_from_json(json_filename)
json_from_sprite(sprite_filename)
{
"filename": "s_light.spr",
"version": 1,
"type": 2,
"bounding_radius": 22.627416610717773,
"beam_length": 0.0,
"sync_type": 0,
"frames": [
{
"type": 0,
"subframes": [
{
"filename": "s_light_0_0.png",
"origin": [-16, 16],
"interval": 0.1
}
]
}
]
}
- 1: Normal Quake. Input images must be paletted (8bpp).
- 32: Darkplaces. Input images must be RGBA (32bpp).
- 0: Parallel upright
- 1: Facing upright
- 2: Parallel
- 3: Oriented
- 4: Parallel oriented
- 0: Synchronized
- 1: Random
- 0: Single
- 1: Group
- 2: Angled (FTEQW only)
- "bounding_radius" is not used by most sourceports, so can safely be set to 0.
- I'm not sure what "beam_length" is used for in any version of Quake.
- "interval" is the length of time between subframes in Group frames.
- Half-Life sprite generation
- Replace "type" values with strings
- Replace "version" value with a string
- Calculate "beam_length" and "bounding_radius" if its not provided
- PIL (
python -m pip install Pillow
)
$ python3 -m venv .venv
# Powershell on Windows
$ .venv/Scripts/Activate.ps1
# Linux
$ . .venv/bin/activate
$ pip install -r requirements.txt
$ python source/sprconv
MIT License
Copyright (c) 2023 erysdren (it/she/they)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.