I want to import an image using Haxe, my image is big but it is 8 bits and it weighs 89kb. The problem occurs when I import it, because the size of the memory grows by 35mb. I suppose it is reserving memory for a 32bit image. Any idea how to import an image of 8bits, without consuming so much memory?
\$\begingroup\$
\$\endgroup\$
5
-
1\$\begingroup\$ Is your image a png or jpeg? Those formats are storage compressions. When you load a png it will unload into full memory size. But im not sure how OpenFL handles compression though, I don't know if openfl handles any gpu compressed image formats. \$\endgroup\$Sidar– Sidar2017-11-24 18:54:59 +00:00Commented Nov 24, 2017 at 18:54
-
\$\begingroup\$ It's a png with alpha and 8bits, but I can covert it to other format. which format do you think can work best? \$\endgroup\$Matías González– Matías González2017-11-24 18:58:09 +00:00Commented Nov 24, 2017 at 18:58
-
\$\begingroup\$ I'm not familiar with OpenFLs system. I don't think any format matters if they unpack fully in memory. What are your targets? Also see: github.com/openfl/lime/issues/872 \$\endgroup\$Sidar– Sidar2017-11-24 18:59:40 +00:00Commented Nov 24, 2017 at 18:59
-
\$\begingroup\$ Only html5. I read the documentation and did not find anything related to the number of bits :( \$\endgroup\$Matías González– Matías González2017-11-24 19:01:41 +00:00Commented Nov 24, 2017 at 19:01
-
\$\begingroup\$ Webgl ( if you're even using that ) supports a few compressed textures. But on targets that do not support those formats it will unpack regardless. You could ask about this in their irc chat and report back? \$\endgroup\$Sidar– Sidar2017-11-24 19:05:47 +00:00Commented Nov 24, 2017 at 19:05
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
Joshua answer the question: https://stackoverflow.com/questions/47478690/image-import-in-haxe-openfl/47479897#47479897
OpenFL currently uses 32-bit memory for images at runtime, regardless of the original compression format. I believe there is an enhancement task open right now to allow for 24-bit, 16-bit and other color formats.