Skip to main content

gmd-editor

A Python library for decoding, encoding, and editing Geometry Dash .gmd level files.

Installation

pip install gmd_editor

Quick Start

from gmd_editor import load, save

# Load a .gmd file
level = load("MyLevel.gmd")

print(f"Object count: {level.object_count}")
print(f"Bounding box: {level.bounding_box()}")

# Iterate over objects
for obj in level:
    print(f"id={obj.id}  x={obj.x}  y={obj.y}")

# Move all objects up by 30 units
level.transform(lambda o: setattr(o, "y", (o.y or 0) + 30))

# Save the modified level
save(level, "MyLevel_modified.gmd")

API Reference

load(path) / save(level, path)

from gmd_editor import load, save

level = load("level.gmd")
save(level, "level_out.gmd")

GMDLevel

Attribute / Method Description
level.objects list[GDObject] — all objects
level.header The level settings string
level.object_count Number of objects
level.bounding_box() (min_x, min_y, max_x, max_y)
level.unique_object_ids() Set of GD object IDs used
level.filter(fn) Filter objects by predicate
level.filter_by_id(id) Filter objects by GD object ID
level.transform(fn) Apply a function to every object in-place
level.add_object(obj) Append a new object
level.remove_objects(fn) Remove matching objects; returns count removed
level.to_level_string() Serialise to raw level string
level.to_gmd_string() Serialise back to full .gmd XML

GDObject

Named property shortcuts (all gettable and settable):

Property Key Type
obj.id "1" int
obj.x "2" float
obj.y "3" float
obj.h_flip "4" bool
obj.v_flip "5" bool
obj.rotation "6" float
obj.scale "36" float
obj.groups "57" list[int]

Raw access for any property:

obj["21"]          # get by numeric key string
obj["21"] = "3"    # set
obj.get("21", "0") # with default
obj.remove("21")   # delete

Low-level codec

from gmd_editor.codec import (
    decode_level_string,  # base64url+gzip → plain text
    encode_level_string,  # plain text → base64url+gzip
    extract_b64,          # pull encoded data from .gmd XML
    inject_b64,           # put encoded data back into .gmd XML
    fix_padding,          # fix GD's broken base64 padding
)

Examples

Teleport all objects to a fixed X position

from gmd_editor import load, save

level = load("level.gmd")
level.transform(lambda o: setattr(o, "x", 0.0))
save(level, "level_out.gmd")

Remove all objects of a specific type

from gmd_editor import load, save

level = load("level.gmd")
removed = level.remove_objects(lambda o: o.id == 8)  # remove all spike objects
print(f"Removed {removed} spikes")
save(level, "level_out.gmd")

Create a new object and add it

from gmd_editor import load, save
from gmd_editor import GDObject

level = load("level.gmd")

new_obj = GDObject()
new_obj.id = 1        # block
new_obj.x = 300.0
new_obj.y = 0.0
level.add_object(new_obj)

save(level, "level_out.gmd")

Work directly with the level string

from gmd_editor.level import GMDLevel

level = GMDLevel.from_level_string("kA,1;1,1,2,100,3,200;")
print(level[0].x)   # 100.0
raw = level.to_level_string()

Metadata

Release files for gmd-editor 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmd-editor 0.1.5
File Size Uploaded Provenance Actions
gmd_editor-0.1.5.tar.gz 8.4 kB Without provenance Details for gmd_editor-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gmd-editor 0.1.5
File Interpreter ABI Platform Actions
gmd_editor-0.1.5-py3-none-any.whl Python 3 none any Details for gmd_editor-0.1.5-py3-none-any.whl

Total release size: 17.7 kB

Release files / gmd_editor-0.1.5.tar.gz

Download URL gmd_editor-0.1.5.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7a1cd6b17a1a917d82384da52516c6b5dd98a489cebecee02728d937649efe6c
BLAKE2b-256 checksum
How to use checksums
033e6c9cb20af79d21682352b46c4997d39a8f542e1cdbc5faa7bd651d331095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Release files / gmd_editor-0.1.5-py3-none-any.whl

Download URL gmd_editor-0.1.5-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ab33e828c8d43f96a44f192353e19d8b17e0c32093b554858e52f54dd938667
BLAKE2b-256 checksum
How to use checksums
486bc451b5ff7d03a57c018d4621d986ce43448c2d7e809f0a144cd502248dc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Security for gmd-editor 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page