0

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?

Koenigsberg
  • 1,726
  • 1
  • 10
  • 22

1 Answers1

1

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()

reden
  • 968
  • 7
  • 14
  • For further understanding - ImageMagick is jMonkey based? Or else how is that command related to the `DesktopAssetManager#loadAsset` command? – Koenigsberg Feb 08 '21 at 12:37
  • It's a tool set used for image manipulation. www.imagemagick.org. I used it simply because I had no 96x96 icon. I used assetManager.loadAsset to load it. – reden Feb 08 '21 at 12:49
  • I see, thank you. Will try creating an Icon this way, then attempting to load it via `loadAsset`. Will report results. – Koenigsberg Feb 08 '21 at 12:52