Error loading images

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
ivanguerr
Posts: 5
Joined: Fri Dec 16, 2005 4:45 am

Error loading images

Post by ivanguerr »

I´m trying to slide two images, one from left to right and the other one from right to left. When both images dissapear from screen I load another two images.

The problem is when I´ve loaded 5 or 6 images, lua shows the "load error image". I tryed to change the image, the path, also checked the correct filename and path.

The program works fine in the lua player windows version. What´s wrong?


x1=-150
x2=480
cont=0
animacionxx=Image.load("imagen/foto00.jpg") --Left to right
animacionyy=Image.load("imagen/foto01.jpg") --Right to left
while true do
screen:blit(x1, 100, animacionxx)
screen:blit(x2, 25, animacionyy)

x1=x1 + 1
if x1 == 480 then
x1=-150
cont=cont+1
if cont == 1 then
animacionxx=Image.load("imagen/foto02.jpg")
elseif cont== 2 then
animacionxx=Image.load("imagen/foto04.jpg")
elseif cont== 3 then
animacionxx=Image.load("imagen/foto06.jpg")
elseif cont== 4 then
animacionxx=Image.load("imagen/foto08.jpg")
elseif cont== 5 then
animacionxx=Image.load("imagen/foto10.jpg")
elseif cont== 6 then
animacionxx=Image.load("imagen/foto12.jpg")
elseif cont== 7 then
animacionxx=Image.load("imagen/foto00.jpg")
end
end

x2=x2 - 1
if x2 == -150 then
x2=480
if cont == 1 then
animacionyy=Image.load("imagen/foto03.jpg")
elseif cont== 2 then
animacionyy=Image.load("imagen/foto05.jpg")
elseif cont== 3 then
animacionyy=Image.load("imagen/foto07.jpg")
elseif cont== 4 then
animacionyy=Image.load("imagen/foto07.jpg")
elseif cont== 5 then
animacionyy=Image.load("imagen/foto11.jpg")
elseif cont== 6 then
animacionyy=Image.load("imagen/foto13.jpg")
elseif cont== 7 then
cont=0
animacionyy=Image.load("imagen/foto01.jpg")
end
end
2Xtremes2004
Posts: 53
Joined: Wed Aug 31, 2005 1:43 am

Post by 2Xtremes2004 »

Sounds like its using all the memory, in windows you have much more memory.
I want my money back!?
Dr. Vegetable
Posts: 171
Joined: Mon Nov 14, 2005 1:32 am
Location: Boston, Massachusetts
Contact:

Post by Dr. Vegetable »

The only strange thing I see is that you load "foto07.jpg" twice. It looks like you never load "foto09.jpg". Maybe there is a problem in Lua loading the same image on top of itself?

I am too lazy to try it myself, though...
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

ACTUALLY... your code is fine.
You have a jpg in there that luaplayer cant read.
open the jpg, edit it with MSPaint, and save it. Just put a black dot in the top left or something, but you have to change the image then save.

try that.
ivanguerr
Posts: 5
Joined: Fri Dec 16, 2005 4:45 am

Post by ivanguerr »

The two photo7s is an error mine, I tried to put others images, so the photo09.jpg is not the problem. I supose is something wrong with the memory although as far I know lua automatic free the memory.

I tried to load diferents images (jpg,png), I tried to load less images too but when it will be load the fifth o the sixth image, the programa crashes....a possible bug of luaplayer? I don´t know, I saw other scripts programs, like millionare, and they loads a lot of images.

Any help to load images with other programming method?

Thanks!!!!
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

make a test program that loads just the image that you are having trouble with. it shouldnt be a bug with luaplayer.. that wouldnt make sense because its an image.
ivanguerr
Posts: 5
Joined: Fri Dec 16, 2005 4:45 am

Post by ivanguerr »

I don´ have the problem with one image, the problem is when I tried to load the fifth/sixth image, whatever the image will be.

For example, if the image photo02.jpg I load in fifth position, the program crashes. I change to load this same image the first position and it´s works perfect.

All the images I try to load are little jpg (between 10kb and 50 kb), so the size of the image is not the problem.

The program works fine in the lua player windows version, for that reason, I guess if maybe there is a little bug in the psp version.
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

Interesting...
Try PNG.
ivanguerr
Posts: 5
Joined: Fri Dec 16, 2005 4:45 am

Post by ivanguerr »

I changed to PNG and the problem persists. I changed a little bit the code, so I create a table to load images:

local animacion1 = {a1=Image.load("imagen/foto00.jpg"),a2=Image.load("imagen/foto02.jpg"),a3=Image.load("imagen/foto04.jpg")}
local animacion2 = {b1=Image.load("imagen/foto01.jpg"),b2=Image.load("imagen/foto03.jpg"),b3=Image.load("imagen/foto05.jpg")}


This table WORKS because it only has 3 images per table. If I try to insert 4 images in every table the program crashes (error:unable to load images).The other new images are good files because if I put them alone in the table, they work.
Post Reply