stbi_load doesn't work with jpg, data is null #1364
-
First of all, here's what I already tried: different paths - relative/absolute, checked the JPEG encoding format (it was always baseline), opened pictures through fopen (they open), and of course tried different pictures. Also tried different versions of stb. Always data is null and always stbi_failure_reason gives this error: "unknown image type". At the same time, it works perfectly with png format. There are several images here that I used: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Tried the first one (in my own codebase, not your test code), it loaded fine for me. What platform are you on and/or what compiler are you using? You could try using fopen to load the file yourself (make sure you open in binary mode), and then use If you're willing to debug it, breakpoint in |
Beta Was this translation helpful? Give feedback.
Tried the first one (in my own codebase, not your test code), it loaded fine for me.
What platform are you on and/or what compiler are you using?
You could try using fopen to load the file yourself (make sure you open in binary mode), and then use
stbi_load_from_memory
and see if that's any different, but I can't imagine why it would be.If you're willing to debug it, breakpoint in
stbi__err()
. Then run until the callstack shows the jpeg decoder (possibly other image formats will be attempted first and generate spurious calls tostbi__err
). Then look up one level on the callstack and see what's calling one of thestbi__err*()
macros.