Extracting sprites from a GameMaker project depends on whether you have access to the source files or are attempting to extract them from a compiled game. The method varies significantly for each situation, and it is important to respect copyright laws and licensing when dealing with assets from games you do not own.
Method 1: Exporting from an open GameMaker project
This is the simplest and most direct method, assuming you have access to the original GameMaker project files.
Step 1: Open the Sprite Editor
In the GameMaker IDE, navigate to the Asset Browser and double-click the sprite you want to export. This will open the Sprite Editor window.
Step 2: Edit the image
Inside the Sprite Editor, click the Edit Image button. This will bring up the Image Editor for that specific sprite.
Step 3: Export as a PNG
With the image editor open, go to the top menu and select Image > Export PNG. GameMaker will then export the sprite's frames as a single, horizontal sprite strip in a PNG file format.
Step 4: Export a single frame
If you want to save a single frame of an animation, follow these steps:
- Navigate to the specific frame in the Image Editor.
- Use the Rectangle Selection tool to select the area of the image you want to save.
- Copy the selected area (
Ctrl+C). - Create a new image in a separate image editor (like Paint.NET, GIMP, or Aseprite) and paste the selection.
- Save the new image as a PNG file.
Step 5: Save dynamically with GML
For more advanced, programmatic extraction, you can use GameMaker Language (GML) to save sprites that were created dynamically at runtime.
-
Create a surface: Use
surface_create()to create a surface to draw your sprite on. -
Draw the sprite: Draw the sprite onto the surface with
draw_sprite()or a similar function. -
Save the surface: Use the
surface_save()function to save the surface to a file. The file must have a.pngextension.gmlvar srf = surface_create(sprite_get_width(my_sprite), sprite_get_height(my_sprite)); surface_set_target(srf); draw_sprite(my_sprite, 0, 0, 0); // Draw the first sub-image of the sprite surface_reset_target(); surface_save(srf, "my_sprite.png"); surface_free(srf);Use code with caution.
Method 2: Extracting from a compiled game
This method is more complex and requires third-party tools to decompile or unpack a compiled GameMaker game's assets. This is only possible for specific game export formats and depends heavily on the GameMaker version used to create the game.
Step 1: Locate the game's data files
Compiled GameMaker games often package all assets into a single file. For Windows exports, this file is typically a data.win file located in the same directory as the game's executable (.exe). For older versions of GameMaker, you might find that simply renaming the .exe to a .zip file allows you to extract some resources.
Step 2: Use an extraction tool
Several tools have been developed by the community to extract assets from GameMaker games. Note that compatibility with the latest GameMaker Studio versions is not guaranteed and can change with every update.
- SpriteRipper (GitHub): A popular tool for extracting spritesheets from GameMaker Studio 1.4 and 2 binaries, including
.winand.exefiles.- Usage: Drag and drop the
.winor.exefile onto the program.
- Usage: Drag and drop the
- Altar.NET: Recommended for extracting from
.data.winfiles, particularly for games built on older GameMaker Studio versions. - GMExtract (GitHub): A command-line tool for extracting sprites from the
data.winfile of games made with GameMaker Studio.- Usage: Run from the command line:
GMExtract inFile outDir -swhereinFileis the path to yourdata.winfile andoutDiris the output folder.
- Usage: Run from the command line:
- UndertaleModTool: While originally created for Undertale, this community-developed tool has broader compatibility with GameMaker Studio games for viewing and extracting assets.
- Usage: Open the tool, navigate to File > Open, and select the game's data file. You can then browse the assets and extract them.
Best practices and legal considerations
- For your own projects: When developing, it is a good habit to keep your original asset files (e.g., PSDs, ASEPRITE files) organized outside of GameMaker. This provides a clean backup and easy access if you ever need to export or reuse them.
- For third-party games: Respect copyright and intellectual property. Extracting assets from a commercial game you do not own is generally not allowed and can have legal consequences. Tools for extracting assets from compiled games are intended for research, modding (with permission), and educational purposes within fair-use guidelines, not for redistribution.