How to load big Images (fast) in Juce?



I have two big Images for my gui and at the moment it needs much time to load them.
Image 1: 1,4 mb -> loadtime = 990ms
Image 2: 6,4 mb -> loadtime = 1994 ms

I load the image’s on the follow way:

   Image * testImg = new Image();
   *testImg = ImageFileFormat::loadFrom(BinaryData::LoadAnimation_png, BinaryData::LoadAnimation_pngSize);

Is there a faster way to load the images?


First, never allocate an Image on the heap, you should just use it as a copy-by-value type!

And no, there’s no faster way… If you’re running on OSX then it’s using the OS’s image loader, which is presumably pretty much optimal. On other OSes it’ll use libpng, which is the industry standard, though you’ll want to test with a release build, as it’ll go much faster than a debug build.

Instead of trying to do it faster, you probably want to do it smarter, e.g. loading it on a background thread or something appropriate for your app.


6mb… Your images are really heavy!
In case it can help, I wanted to mention that I often use to compress pngs.
I generally got drastic size reduction without any quality loss, so I would recommend it.
you may give it a try (note however that the max input size is 5MB…)


thanks for your answers. You helped me a lot.