Problem with JPGs?

Monkey Targets Forums/Desktop/Problem with JPGs?

SLotman(Posted 2013) [#1]
I don't know what's going on here, but I can't load this simple JPG, no matter what I do in Monkey.



But If I just open this image on Paint and re-save it, then it loads!

Whats going on here??? The image is a standard JPG, not even with "progressive encoding".

Its not the image size, since I just rescaled it to 512x512 and it still won't load.

Edit: It doesn't load on HTML5 as well... also, updating stb_image.c on glfw didn't help at all (latest version is 1.33, monkey version is 1.29!)

Edit 2:It's not a stb bug as I suspected - there's an 'stb viewer' using this exact library, and it can open the image without any problem whatsoever.

Edit 3:The difference between Paint's image and the other one, is that paint *adds* some "exif" data into the header, making the images bigger than it has to be. Really don't know how to fix this :P


SLotman(Posted 2013) [#2]
I just did a quick test altering mojo.glfw with a small debug:
gxtkSurface *gxtkGraphics::LoadSurface__UNSAFE__( gxtkSurface *surface,String path ){
	int width,height,depth;
	unsigned char *data=BBGlfwGame::GlfwGame()->LoadImageData( path,&width,&height,&depth );
	if( !data ) return 0;
	char tmpString[1024];
   sprintf(tmpString, "image parameters w:%d, h:%d, d:%d", width,height,depth);
   printf(tmpString);
	surface->SetData( data,width,height,depth );
	return surface;
}


And as a result, I see the image is being read incorrectly. For the crab image, this reports:

image parameters w:180, h:24, d:4

And the fact that this happens on HTML5, GLFW and Android points to a problem outside stb or a single target.
(Can someone move this to bug reports please?)