Skip to main content
swamp222
Inspiring
February 5, 2017
Question

Memory usage on loaded bitmaps.

  • February 5, 2017
  • 1 reply
  • 685 views

Hi,

When loading an image from a folder (1920x1920) and adding to stage, the memory use in Scout goes up to 14.4mb (Bitmap DisplayObjects).

When instantiating the same image from library and adding to stage, the memory stays at 3.6mb.

Am I missing something?

I'm running CS6 with Air 23.

Here's my code:

public function loadBitmap(): void
{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest("app:/assets/images/WIND.png"));
}
function onLoaded(event){
var bitmap:Bitmap = new Bitmap(event.target.content.bitmapData, "auto", true);
addChild(bitmap);
}
function loadFromLibrary(){
var bitmap:Bitmap = new Bitmap(new Wind(0,0), "auto", true);
addChild(bitmap);
}

Regards,

T

This topic has been closed for replies.

1 reply

User Unknow
Legend
February 13, 2017

1920x1920x4/1024=14400

Image consist from pixel. Width * height = amount of pixels. Each pixel can use alpha. So without alpha it's 3 channels RGB and with alpha it's 4 channels ARGB. So 1920x1920x4 it's width * height * channels count = 14745600 bytes it's 14 400 kb's or 14.4 mb

swamp222
swamp222Author
Inspiring
February 14, 2017

Okay!

So somehow embedded library manages to ignore the alpha channel but still renders alpha?

Since they take 4 times less memory.

User Unknow
Legend
February 14, 2017

less memory it's 3 channel RGB without 4th - A. You can't use Alpha without it. Without alpha your PNG will be just JPG