Welcome! Log In Create A New Profile

Advanced

JPG loading

Posted by Chicken_Bones 
JPG loading
August 30, 2010 12:26PM
Whenever I try to load a jpg either from sd or inbuilt with GRRLIB_LoadTexture() or GRRLIB_LoadTextureJPG() or GRRLIB_LoadTextureFromFile() the wii always returns to the homebrew channel
Re: JPG loading
August 30, 2010 02:43PM
what size (dimensions not disk space) is the jpg?

the dimensions have to be a power of 4

ie 640 x 480 will work
240 x 120 will work
20 by 60 will work

31 x 67 will not work.



Edited 1 time(s). Last edit at 08/30/2010 02:45PM by mdbrim.
Re: JPG loading
August 30, 2010 04:24PM
Try to use GRRLIB_LoadTextureJPGEx instead of GRRLIB_LoadTextureJPG.
Re: JPG loading
August 31, 2010 08:59AM
Can I use GRRLIB_LoadTextureJPGEx with GRRLIB_LoadTextureFromFile?

68x52
Re: JPG loading
August 31, 2010 03:26PM
Quote
Chicken_Bones
Can I use GRRLIB_LoadTextureJPGEx with GRRLIB_LoadTextureFromFile?
No, but you can use it with GRRLIB_LoadFile, but you will need to add some custom code.
Re: JPG loading
September 01, 2010 09:18AM
Makes no difference :( still exits to homebrew channel
Re: JPG loading
September 01, 2010 03:38PM
With no code, it's impossible to tell whats wrong. Please paste some code somewhere we could have access to.
Re: JPG loading
September 02, 2010 12:01PM

int countfiles()
{
	DIR* smalldir = opendir("sd:/daylily pics/small");
	DIR* bigdir = opendir("sd:/daylily pics/big");
	
	int filebig=0, filesmall=0;

	if ((smalldir != NULL)&&(bigdir != NULL))
	{
		while(true) 
		{
			struct dirent* pent = readdir(smalldir);
			if(pent == NULL) break;
			
			if(strcmp(".", pent->d_name) != 0 && strcmp("..", pent->d_name) != 0)
			{
				char dnbuf[260];
				sprintf(dnbuf, "%s/%s", "sd:/daylily pics/small", pent->d_name);
				
				struct stat statbuf;
				stat(dnbuf, &statbuf);
				
				if(!S_ISDIR(statbuf.st_mode))filesmall++;
				GRRLIB_FillScreen(0x00FFFFFF);
				GRRLIB_Printf(10,10,font,0xFFFFFFFF,1,"loading %i,%i",filesmall,filebig);
				GRRLIB_Render();
			}
		}
		
		closedir(smalldir);
		
		while(true) 
		{
			struct dirent* pent = readdir(bigdir);
			if(pent == NULL) break;
			
			if(strcmp(".", pent->d_name) != 0 && strcmp("..", pent->d_name) != 0)
			{
				char dnbuf[260];
				sprintf(dnbuf, "%s/%s", "sd:/daylily pics/small", pent->d_name);
				
				struct stat statbuf;
				stat(dnbuf, &statbuf);
				
				if(!S_ISDIR(statbuf.st_mode))filebig++;
				GRRLIB_Printf(10,10,font,0xFFFFFFFF,1,"loading %i,%i",filesmall,filebig);
				GRRLIB_Render();
			}
		}
		
		closedir(bigdir);
	}
	else
	{
		exit(0);
	}
	
	if(filesmall==filebig)
	{
		return filesmall;
	}
	else
	{
		exit(0);
		return -1; //for sake of compiler error
	}
}

int main()
{
	WPAD_Init();
	WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR);
	WPAD_SetVRes(WPAD_CHAN_ALL, 640, 480);
	
	fatInitDefault();
	
	GRRLIB_Init();
	font = GRRLIB_LoadTexture(font_png);
	GRRLIB_InitTileSet(font, 26	, 36, 0);
	
	srand(time(0));
	
	int i=0,j=0;
	
	int filecount=countfiles();
	
	string picnames[filecount];
	
	DIR* smalldir = opendir("sd:/daylily pics/small");
	
	GRRLIB_texImg *jpegtest=GRRLIB_LoadTextureJPGEx(elizabeth_hay_jpg, 0x32F6);
//other stuff exits before doing anything here
}
Re: JPG loading
September 02, 2010 04:44PM
Just to be sure, are you sure the file size for elizabeth_hay_jpg is 0x32F6 (13046 bytes)? Why do you write it in hex, it's just more complicated to read. If you use WiiBuilder or raw2c, the size for elizabeth_hay_jpg should be elizabeth_hay_jpg_size.
Re: JPG loading
September 03, 2010 08:30AM
I put the JPG in the data folder and opened it with hex editor to get size
Re: JPG loading
September 06, 2010 06:59AM
it seems like it was a problem with my jpeg as other jpgs worked. any ideas why? it ended in 0xD9 0xFF and started the same way others that worked did?
Re: JPG loading
September 06, 2010 08:14PM
The size of your image is 68x52 pixels?
Re: JPG loading
September 07, 2010 09:30AM
Re: JPG loading
September 07, 2010 03:10PM
Chicken bone... did you resize this image with photoshop?

I seem to recall a similar problem from the GRRLIB forum and it turned out that the image had TWO occurances of 0xD9 0xFF.

That's why some JPG work for you and others don't...

The solution ended up being due to photoshop resize added a 0xD9 0xFF.... and they tried resizing with something else.

Wait... here ya go. See if this is related / helps: GRRLIB JPEG Problem
Re: JPG loading
September 07, 2010 05:03PM
But when you use GRRLIB_LoadTextureJPGEx, it's not looking for 0xD9 0xFF. The second parameter is the size of the image, so no need to find the end of the file.



Edited 1 time(s). Last edit at 09/07/2010 05:04PM by Crayon.
Re: JPG loading
September 07, 2010 09:36PM
ahhh, good point, i glossed right over that detail...

Well, did you try using "elizabeth_hay_jpg_size"?
Re: JPG loading
September 08, 2010 02:13PM
I had 82 images all needing to be resized so I used advanced batch conveter for the resizing. But even GRRLIB_LoadTextureJPGEx doesn't work.
Re: JPG loading
September 08, 2010 04:50PM
Could you put the JPEG image that is causing problem somewhere on Internet so I can download it.

BTW mdbrim and I asked you to use elizabeth_hay_jpg_size, but you did not give any feedback.



Edited 1 time(s). Last edit at 09/08/2010 04:52PM by Crayon.
Re: JPG loading
September 09, 2010 02:23PM
I did use elizabeth_hay_jpg_size and no use

will post pic soon



Edited 1 time(s). Last edit at 09/09/2010 02:24PM by Chicken_Bones.
Sorry, only registered users may post in this forum.

Click here to login