6
\$\begingroup\$

I can't see this mentioned in the documentation. Am I missing something obvious? Or does SFML really give you no option, forcing everything to be loaded as RGBA8888?

Searches on Google and the SFML forums have been unproductive.

\$\endgroup\$
3
  • \$\begingroup\$ I think I remeber beeing able to load other formats too. Do you have any particular code snippet which results in an error? \$\endgroup\$
    – floAr
    Commented Sep 13, 2013 at 11:00
  • \$\begingroup\$ No, I do not. I remember doing some research and working with code, and either finding nothing or finding a way I thought would work, but when attempting it the memory usage was identical either way. I will try again shortly. \$\endgroup\$
    – Carter81
    Commented Sep 13, 2013 at 12:02
  • 1
    \$\begingroup\$ You might need to check if SFML can compress your RGBA8888 images on loading. Of course that means longer loading times and usually worse compression quality, but at least that is something to get you started. \$\endgroup\$
    – Kromster
    Commented Sep 16, 2013 at 5:18

1 Answer 1

1
\$\begingroup\$

SFML, at least as of version 2 and as of this writing, uses stb_image (available here) to load image data, except on Android platforms. You can verify this by checking the source (Image.cpp and ImageLoader.cpp in particular).

Most of the documentation for stb_image is in the header file; SFML's particular version of it is here (be warned: it is large). However, while the header comments do point out some limitations for particular file formats, there's nothing in there that seems to imply RGBA8888 only (although for the PNG format, it sounds like you can only have 8-bit channels so RGBA4444 is probably out).

Thus, the short answer is: yes, but with some limitations depending on the file format.

\$\endgroup\$
2
  • \$\begingroup\$ I looked over the source a bit closer, and just to confirm: yes it only supports 8-bit formats, and yes it does optionally support alpha channel as well as other valid PNG format combinations such as indexed and gray scale. \$\endgroup\$
    – user39686
    Commented Apr 29, 2014 at 4:48
  • \$\begingroup\$ I liked to add that internally, SFML stores images as RGBA8888 because each pixel is a sf::Color which is 1 byte for each channel. \$\endgroup\$
    – Xplane
    Commented Sep 11, 2014 at 10:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .