Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Okay!
So somehow embedded library manages to ignore the alpha channel but still renders alpha?
Since they take 4 times less memory.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Okay thanks!
/T