Search code examples
javajmonkeyengine

Does jMonkey support 96x96 .ico assets?


Summary

A Java application uses jMonkey for rendering purposes. This application is loading a custom icon when in view mode. The icon in use is 32x32 and is loaded like this, as it is a cursor:

JmeCursor cursor = (JmeCursor) Services.getAssetManager().loadAsset( "/path/someIcon.ico" );

Where Services is just some irrelevant class to retrieve the jMonkey AssetManager.

I read about typical .ico sizes and one of them appears to be 96x96. However when attempting to load a 96x96 .ico file as an asset using the code snippet above, I ran into jMonkey not being able to load the asset, even though according to debugger output the resource was indeed found.

When checking with the debugger, I can follow the loading process into the DesktopAssetManager#loadAsset until it dives deeper into classes I cannot see and then a Throwable without useful stack trace, message or other info shows up. When I switch to any other 32x32 .ico file all works fine again.

Question

Right to the chase:

Is jMonkey capable of loading 96x96 .ico files as assets via loadAsset?


Solution

  • Yes. I created an .ico with the following imagemagick command (and added a 96x96 option):

    convert image.png  -bordercolor white -border 0 \
          \( -clone 0 -resize 16x16 \) \
          \( -clone 0 -resize 32x32 \) \
          \( -clone 0 -resize 48x48 \) \
          \( -clone 0 -resize 64x64 \) \
          \( -clone 0 -resize 96x96 \) \
          -delete 0 -alpha off -colors 256 favicon.ico
    

    Source: https://unix.stackexchange.com/questions/89275/how-to-create-ico-file-with-more-than-one-image/89276#89276

    ImageMagick: https://imagemagick.org/

    It loaded without problems using assetManager.loadAsset()