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?

  • 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
    Nov 24 '17 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\$ Nov 24 '17 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
    Nov 24 '17 at 18:59
  • \$\begingroup\$ Only html5. I read the documentation and did not find anything related to the number of bits :( \$\endgroup\$ Nov 24 '17 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
    Nov 24 '17 at 19:05

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.