A high-resolution osu! skin is a pair of files for almost every sprite: cursor.png and cursor@2x.png, hitcircle.png and hitcircle@2x.png, and the same for animation frames. It is easy to export only the @2x file, or to leave an old 1x file after a rename, and only notice in play when one resolution falls back to the default art. This script walks a skin folder (the folder that contains skin.ini) and reports 1x files that have no @2x partner, and @2x files that have no 1x partner.
It uses only the Python standard library. Point it at the root of a skin.
#!/usr/bin/env python3
"""Report unpaired 1x and @2x image files in an osu! skin folder."""
import sys
from pathlib import Path
EXTS = {".png", ".jpg", ".jpeg", ".gif"}
def stems_in(folder: Path) -> set[str]:
found: set[str] = set()
for p in folder.rglob("*"):
if not p.is_file() or p.suffix.lower() not in EXTS:
continue
name = p.name
suffix = p.suffix
if name.endswith("@2x" + suffix):
stem = name[: -len("@2x" + suffix)]
found.add(stem + "@2x")
else:
found.add(p.stem)
return found
def main() -> int:
if len(sys.argv) != 2:
print("usage: check_2x_pairs.py /path/to/skin-folder", file=sys.stderr)
return 2
root = Path(sys.argv[1])
if not root.is_dir():
print("not a folder: " + str(root), file=sys.stderr)
return 2
have = stems_in(root)
sd_stems = sorted(s for s in have if not s.endswith("@2x"))
hd_stems = sorted(s[: -len("@2x")] for s in have if s.endswith("@2x"))
missing_hd = [s for s in sd_stems if (s + "@2x") not in have]
missing_sd = [s for s in hd_stems if s not in have]
paired = [s for s in sd_stems if (s + "@2x") in have]
print("checked %d 1x stems and %d @2x stems in %s" % (len(sd_stems), len(hd_stems), root))
print("paired %d" % len(paired))
for stem in paired:
print(" ok " + stem)
print("1x without @2x: %d" % len(missing_hd))
for stem in missing_hd:
print(" no@2x " + stem)
print("@2x without 1x: %d" % len(missing_sd))
for stem in missing_sd:
print(" no1x " + stem + "@2x")
return 1 if (missing_hd or missing_sd) else 0
if __name__ == "__main__":
raise SystemExit(main())
Save it as check_2x_pairs.py and run python3 check_2x_pairs.py /path/to/skin. A complete paired set prints only the counts and exits 0. Missing 1x or missing @2x files exit 1, so you can use it in a packing script. Animation frames are treated as their own stems (menu-back-0 is paired with menu-back-0@2x, not with menu-back).
A typical report looks like this when a folder has a 1x cursor, an HD hitcircle with no 1x partner, and a complete HD/SD pair for the approach circle:
checked 2 1x stems and 2 @2x stems in /tmp/skin_2x_test244
paired 1
ok approachcircle
1x without @2x: 1
no@2x cursor
@2x without 1x: 1
no1x hitcircle@2x
I ran the script on a temporary folder that contained cursor.png, hitcircle@2x.png, and both approachcircle.png and approachcircle@2x.png. It reported the cursor as 1x without @2x, the hitcircle as an @2x file without a 1x partner, and the approach circle as a complete pair. After adding hitcircle.png, the next run moved that stem out of the unpaired list.
If you are still checking how complete skins organise their HD assets, you can browse finished skins on osuskins.org and then re-run the script on your own folder before you export the .osk.
Top comments (0)