• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE How to Avoid Sprite Image Resize in Memory?

L

leikela

Guest
If I load images into a sprite, even if they're already perfectly sized, GameMaker seems to resave them at a much higher memory cost. For instance, if I have five images that I've saved at less than 1MB each and I load them into the sprite, when I look at the sprite files, GameMaker has resaved them so they're all between 5-10 MB each. This means my game size ends up being about 10 times bigger than it has to be and switching between images is very slow. How can I avoid GameMaker saving my images at a larger filesize in memory, even though it's doing no scaling? (It seems to forceably convert them to pngs)
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
This is not for scaling, but for compatibility. Your sprites are packed together as texture pages, which are stored uncompressed in memory. Compressing these would lead to an increase in loading times. Similarly, compressing everything on disk would lead to an increase in saving time. You don't want this, especially for larger projects.

It's not possible to disable this. You may try to fight it, but every time you perform any changes to the sprites in question, they'll be re-saved in the default internal format. In the worst case, your compression attempts will render the sprites unreadable by GM if it doesn't support your type of compression.
 
L

leikela

Guest
This is not for scaling, but for compatibility. Your sprites are packed together as texture pages, which are stored uncompressed in memory. Compressing these would lead to an increase in loading times. Similarly, compressing everything on disk would lead to an increase in saving time. You don't want this, especially for larger projects.

It's not possible to disable this. You may try to fight it, but every time you perform any changes to the sprites in question, they'll be re-saved in the default internal format. In the worst case, your compression attempts will render the sprites unreadable by GM if it doesn't support your type of compression.
I don't need to compress them past "normal" but if I load in a PNG that is 2 MB why does GameMaker resave that PNG as a 8 MB image? Surely it isn't uncompressing the picture.
 

rIKmAN

Member
I don't need to compress them past "normal" but if I load in a PNG that is 2 MB why does GameMaker resave that PNG as a 8 MB image? Surely it isn't uncompressing the picture.
Are you talking about "on disk" or "in memory" - because you interchanged them in your OP but they aren't the same thing.
Images are loaded into VRAM uncompressed and will be W*H*4 bytes when loaded into memory, which will be larger than the "on-disk" size.
 
L

leikela

Guest
Are you talking about "on disk" or "in memory" - because you interchanged them in your OP but they aren't the same thing.
Images are loaded into VRAM uncompressed and will be W*H*4 bytes when loaded into memory, which will be larger than the "on-disk" size.
I'm referring to the on-disk size. If I look at what gets saved in the sprite folder by GameMaker in file explorer, GM has resaved the images as pngs (even though they were pngs to start with) at maximal png save size (I compared against how Photoshop saves pngs to see the different memory sizes possible).

I can go into these folders and delete these "enlarged memory" pngs and replace them with my original low memory pngs, and as long as I keep the names the same, everything works fine. This seems to imply that GM isn't actually resaving the images because it needs to/because it does something with them, but rather as a default behavior in case someone uploads a jpg or something for instance. Is there a way to turn off this default resave to avoid the unnecessary on disk enlargement?
 
Top