Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Alternative to SOIL  (Read 5896 times)

0 Members and 1 Guest are viewing this topic.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Alternative to SOIL
« on: November 05, 2010, 04:00:22 pm »
I'm not too familiar with SOIL and know almost nothing about its alternatives, but I did think this would still be worth mentioning. So far, my experiences with loading images in SFML (namely PNG) has been less than ideal. Most any PNG that has been optimized (optipng, pngcrush, etc) seems to completely fail to load. I have also had a few people using my engine mention that PNGs created by some applications also fail to load.

So, is there any better alternative to SOIL that could be used for SFML? Or is there a particular reason for SOIL being used? Or...?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Alternative to SOIL
« Reply #1 on: November 05, 2010, 04:46:20 pm »
SFML doesn't use SOIL anymore, it now directly uses stb_image. It doesn't change anything because SOIL uses stb_image, but at least you don't focus on the wrong library if you search fixes or alternatives.

stb_image is very handy for me, its license is permissive enough and it's only one source file that I can include directly into the source code of SFML.

However I agree that it's a real problem if many valid PNGs can't be loaded.

Maybe you can send me some of the PNGs that are not working (with the options that you used to create them) so that I can contact the author and ask him to fix his code :P

Another solution would be to use libpng, as it's the only format that causes problems (apparently).
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Alternative to SOIL
« Reply #2 on: November 05, 2010, 05:02:13 pm »
Mm, I like the idea of using libpng. Even if it doesn't help with other formats, PNG is easily the most popular when it comes to 2d games. It does look like stb_image doesn't have complete JPEG support either, though (no progressive support, for instance).

From what I can see, DevIL seems to use libpng internally and provide an easier interface for it. At the same time, it supports many other formats.

But again, I have almost no experience with image loading libraries. I have always used higher level libraries like SFML to do it for me. ;)

In any case, I really think using libpng would be a great idea, no matter the approach.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Alternative to SOIL
« Reply #3 on: November 05, 2010, 05:06:40 pm »
Quote
It does look like stb_image doesn't have complete JPEG support either, though (no progressive support, for instance).

I can live with most of the limitations of stb_image. Progressive JPEG is for internet, not for desktop applications.

Quote
From what I can see, DevIL seems to use libpng internally and provide an easier interface for it. At the same time, it supports many other formats.

DevIL is good, but is a bigger dependency and is LGPL.
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Alternative to SOIL
« Reply #4 on: November 05, 2010, 05:26:19 pm »
Quote from: "Laurent"

I can live with most of the limitations of stb_image. Progressive JPEG is for internet, not for desktop applications.


While I do agree it doesn't make sense to use, it is just a nice convenience - especially when you are unfamiliar with the library and just expect it to work. But not really an issue, just a nice convenience, and definitely not something worth putting much effort into or having result in more dependencies.

How about FreeImage? That, too, uses libpng and has OpenGL integration. But since it is a "full package" kind of thing, I could see this introducing too many extra dependencies as well. And the choices of license are between GPL and the "FreeImage Public License", which looks a lot like LGPL.

Not like I personally really want anything other than better PNG support, just figured might as well mention these while I'm at it. :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Alternative to SOIL
« Reply #5 on: November 07, 2010, 05:59:14 pm »
Here is the answer of the author of stb_image:
Quote
i don't know what the issue with optimized PNGs would be; if
you can send me one I'll be happy to take a look at it. I've
definitely viewed images made with pngcrush, but maybe
they're doing new stuff in newer versions, or maybe it's a
rare optimization producing a case not normally exercised.
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Alternative to SOIL
« Reply #6 on: November 07, 2010, 08:57:01 pm »
Well this is really odd, for some reason things are loading fine now. It used to be very easy to make it fail to load an optimized PNG, but even after running pngcrush -brute on all my PNGs and reverting to an earlier version of my code (where I know the failure happened), it works just fine.

I have no idea what changed, but guess its a good thing.

If it ever happens again I'll be sure to post back.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Alternative to SOIL
« Reply #7 on: November 07, 2010, 09:31:05 pm »
He he, ok :P
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Alternative to SOIL
« Reply #8 on: November 09, 2010, 01:58:59 am »
Alrighty, back in business. OptiPNG seems to enjoy causing trouble:

http://www.netgore.com/temp/badpngs.rar

Switches used:
Code: [Select]
-quiet -fix -o7

Files marked with "-opt" are the optimized ones, and the others are the originals. The originals work fine, optimized don't. All loaded just fine by every other program I tried.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Alternative to SOIL
« Reply #9 on: November 09, 2010, 08:01:18 am »
Forwarded.

Than you :)
Laurent Gomila - SFML developer

 

anything