Skip to content

Instantly share code, notes, and snippets.

@iconmaster5326
Last active November 27, 2025 17:29
Show Gist options
  • Select an option

  • Save iconmaster5326/94c25d2adf6479777307f313715ba75b to your computer and use it in GitHub Desktop.

Select an option

Save iconmaster5326/94c25d2adf6479777307f313715ba75b to your computer and use it in GitHub Desktop.
Converting Dragon Spirits graphics to/from .png/.rvdata2
# Run this in the root directory of a RPG Maker project.
import os
POSTFIX = ".png"
RVDATA2_HEADER = b"\x85\xa1\x39\x38\x3f\xd3\x3d\x6d"
for dirname, dirs, files in os.walk(os.path.join(os.curdir, "Graphics")):
print(f"Walking through {dirname}...")
for file in files:
if file[-len(POSTFIX):] == POSTFIX:
infilename = os.path.join(dirname, file)
outfilename = infilename[:-len(POSTFIX)] + ".rvdata2"
print(f"Converting {infilename} to {outfilename}!")
with open(infilename, "rb") as infile:
with open(outfilename, "wb") as outfile:
outfile.write(RVDATA2_HEADER + infile.read()[len(RVDATA2_HEADER):])
# Run this in the root directory of a RPG Maker project.
import os
POSTFIX = ".rvdata2"
PNG_HEADER = b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"
for dirname, dirs, files in os.walk(os.path.join(os.curdir, "Graphics")):
print(f"Walking through {dirname}...")
for file in files:
if file[-len(POSTFIX):] == POSTFIX:
infilename = os.path.join(dirname, file)
outfilename = infilename[:-len(POSTFIX)] + ".png"
print(f"Converting {infilename} to {outfilename}!")
with open(infilename, "rb") as infile:
with open(outfilename, "wb") as outfile:
outfile.write(PNG_HEADER + infile.read()[len(PNG_HEADER):])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment