0 votes

I'm currently making a character creator for my game. The way you use it is by putting an image and a text file in the user folder.

The image is a sprite sheet, and the text file defines the coordinates in which the image will be cropped.
To crop the frames, i'm using the Image.get_rect() method. Then, i add the images as frames in a SpriteFrames node, and use the ResourceSaver class to save the resource in the user dir.
The problem is: those saved SpriteFrames weigh an ungodly amount more than the original files, even when i use the "compress" flag in the save() method.

Why does this happen?

enter image description here

Godot version 3.3.1
in Engine by (19 points)

What's in the file? You should be able to open it in a text editor.

All it has are the elements that define the color of every pixel and the (very few) lines that define each one of the animations.

1 Answer

+1 vote
Best answer

This is likely because the image data is embedded into the file. If you save this file as a .tres file, binary data will be encoded as Base64, making it at least 33% larger. It will also load and save slower compared to a binary file.

To avoid this, save the SpriteFrames resource as a binary .res file, or better, ensure that all images are saved as external .png files.

by (10,303 points)
selected by

Thank you so much! The resource files are still heavier than the original files, but have reduced in size by 50mb. I honestly can't thank you enough!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.