File sizes not changing

For questions about using Classic.

Post » Tue Jan 26, 2010 9:08 pm

In trying to fix my complete-but-broken huge project, I came across the following oddity:
when I remove a large sprite from the game, the filesize of the resulting .EXE doesn't change. In one case I replaced a .bmp with a .jpg and the resulting file was actually bigger.

I also tried this on a new project and it still does more or less the same. It's as if Construct actually keeps all the information you've ever put into it.

Am I missing something or should I report this as a bug?
B
2
G
3
Posts: 50
Reputation: 950

Post » Tue Jan 26, 2010 9:35 pm

Construct compresses all images as .png, it doesn't matter what format you're importing.

But if you're importing a .jpg, then yes it will likely be a larger filesize than if you're importing a .bmp because jpeg compression is crap and causes extra color information due to artifacts. Png compression is optimized for areas of similar color, if you have lots of little changes in color information then the file size is going to go up.

Example:

http://dl.dropbox.com/u/529356/bigred.PNG
This image is only 9.6kb, even though the physical dimensions are large. There is no change in color info from one pixel to the next.

http://dl.dropbox.com/u/529356/smallSpray.PNG
This image is 33.6kb even though it's got much smaller dimensions than the first image. The reason is that there is a lot of change in color info from pixel to pixel. That's almost four times more disk space.

When you use .jpg compression, it causes little blurry artifacts at the edges of where colors change, in essence making a whole lot more colors than were there before. In short, .jpg is terrible for games and you shouldn't use it. Not only is it inefficient, it's ugly.

As for removing the sprite from the game and the .exe not changing size... did you remove all instances of the sprite, or just one copy of it?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Jan 26, 2010 9:44 pm

jpg hijack Q:

So say I had a jpg pic. Should I load it in to photoshop and re-save as a png? Or has the dammage been done since it started as a jpg?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Tue Jan 26, 2010 9:46 pm

[quote="deadeye":3lz1horv]
As for removing the sprite from the game and the .exe not changing size... did you remove all instances of the sprite, or just one copy of it?[/quote:3lz1horv]

All. Definitely all. In my simple test, there was only one layout and one object.

These were the sizes of the .exes in the test project:

Completely empty layout: 657kb
Layout with large sprite: 3.54MB
Layout with large sprite deleted: 3.34MB

In my large project, the file sizes didn't change at all when I removed several huge objects.
B
2
G
3
Posts: 50
Reputation: 950

Post » Tue Jan 26, 2010 10:22 pm

[quote="Guyon":2636v9pn]jpg hijack Q:

So say I had a jpg pic. Should I load it in to photoshop and re-save as a png? Or has the dammage been done since it started as a jpg?[/quote:2636v9pn]

The damage has been done.

To be safe you should probably just save all of your artwork as .png to begin with. Or .bmp. But .png supports alpha transparency, and Construct imports the alpha just fine and converts everything to .png anyway so, yeah, no reason not to use .png.

[quote="JonasKyratzes":2636v9pn][quote="deadeye":2636v9pn]
As for removing the sprite from the game and the .exe not changing size... did you remove all instances of the sprite, or just one copy of it?[/quote:2636v9pn]

All. Definitely all. In my simple test, there was only one layout and one object.

These were the sizes of the .exes in the test project:

Completely empty layout: 657kb
Layout with large sprite: 3.54MB
Layout with large sprite deleted: 3.34MB

In my large project, the file sizes didn't change at all when I removed several huge objects.[/quote:2636v9pn]

That definitely sounds like a bug. Try this: Delete the large sprite, then save and close. Then reopen the .cap and export an .exe and see what that filesize is. It could be that it's just a memory issue with the IDE. It does still have to save the object in memory in case you want to undo the delete, after all... maybe something is getting fudged between that and exporting a build.

At any rate it's probably going to have to go to the tracker, but getting as much info as you can on what's going wrong will help the devs figure it out.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests