Image memory usage

Hi everyone,
My plugin usually uses around 10MB of memory (according to the Visual Studio diagnostic tools), but as soon as i load an image from memory it jumps to around 40MB. The image is in .jpg format and its size is around 400KB. The image is loaded in the editor constructor by the ImageCache::getFromMemory funtion.

Is this normal behavoiur or am i doing something wrong?

Image holds bitmaps, not the compressed data. Maybe your jpg expands to a large bitmap?

@xenakios thanks, it seems you are right! I converted the image to .bmp format its size jumped to 36MB. Is there any other, more efficient way for loading images, or is this the best one?

Well, if you’re using the ImageCache class, it caches the image. Depending on your use case, you might get off with decompressing the image in the paint routine directly. None of the solutions is ideal though…

The question is what is the Image is used for, can you replace the Image with a paint routine? So instead of drawing the image can you replicate the Image with paint commands? Or if it’s only vectors you can try using a svg and draw that.