-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
same jpeg image decode incorrect #695
Comments
TL;DR - probably user application error. The image as presented here round-trips correctly through #define STB_IMAGE_IMPLEMENTATION 1
#define STB_IMAGE_WRITE_IMPLEMENTATION 1
#include "stb_image.h"
#include "stb_image_write.h"
#define IN_FILENAME "/mnt/y/Downloads/51249360-fcb19f80-19cd-11e9-86eb-787bb44422ac.jpeg"
#define OUT_FILENAME "/mnt/f/Temp/car.png"
int main() {
int x, y, n;
unsigned char* data = stbi_load(IN_FILENAME, &x, &y, &n, 0);
fprintf(stderr, "x: %d, y: %d, n: %d\n", x, y, n);
stbi_write_png(OUT_FILENAME, x, y, n, data, 0);
free(data);
return 0;
} My psychic debugging hat tells me that you are uploading the image to OpenGL without setting |
@zao Thank you very much. It is GL_UNPACK_ALIGNMENT reason. 再次感谢你! |
I am a new in using stb_image. I load a jpeg picture to opengl texture by using stb_image. and I find the picture not correct. but when I use ImageMagick to load the picture it is good! I do not know why, Is this a bug in stb_image or this kind of jpeg is not supported ? anyone can help me, Thank you very much.
original image:
stb_image load to texture:
The text was updated successfully, but these errors were encountered: