Increased image size after build

I’m testing one of this week’s code challenge projects. The project did not have an icon, so I downloaded an icon and created the 3 required sizes for it: 24x24, @2 48x48 and @3 72x72.

I used ImageOptim to reduce each PNG size to:
24x24 - 303 bytes
48x48 - 528 bytes
72x72 - 689 bytes

After I ran the project, I found the images inside the build.debug/resources directory and each PNG size is:
24x24 - 1,515 bytes
48x48 - 1,875 bytes
72x72 - 2,215 bytes

Why they grow so much?

Note: I can use ImageOptim to reduce the size back to 303, 528 and 689, any harm on doing that?
For Desktop apps is not a big deal, but for webapps every little bit help.

Edit: My guess is that ImageOptim is removing metadata that Xojo adds to the PNG, so maybe is not a good idea to remove that, but I don’t know.

You can use build script step to copy the smaller files into the app after building.

Alberto, (last time I asked), nobody here has fear of a 32MB application (on WIndows) or a 4MB Hello World application on Mac OS.

Also, you do not install an App.icns (MacOS) icon for the Application (@ 1024 x 1024 and smaller sizes)… Look at the project size / load and Save time too !

Thank you Christin, is not hard to do that or manually replace them, just wondering why the increase.

Emile, exactly, I don’t fear the size on Windows or Mac app, just thinking in a future web project. There are people with very slow internet connections, so every KB saves is a plus.

I did more tests. What I found using Preview’s inspector (what Xojo create vs ImageOptim):

  • the ColorSync profile Generic RGB Profile is removed
  • image DPI is changed to 72
  • DPI Height and DPI Width are removed
  • Profile name, removed
  • X/Y pixels per meter are removed

I also used ImageOptim on the default png and ico images (appicon, favicon, homescreen), with an average file size save of 23.3%, saved 44KB out of 182KB, and the webapp works the same (from what I can tell).

From experience, several website test tools check if the images are optimized for web, some even say how much they can be ‘compressed’ without quality loss. Having the smallest images possible will result in a better report and a little faster time.

I know that maybe I need to worry about other things before trying to optimize web images. I was just curious.

I expect Xojo loads them and than writes new png without optimizations.

I have a slow connection at home…

Probably to be sure the image is OK (IMHO).

I have confirmed this is what happens.

I don’t use imageOptim, I use my own ICNSmini to compress PNG files and they must be added in a build script to get the file savings.