| View previous topic :: View next topic |
| Author |
Message |
puffo83
Joined: 02 Jun 2006 Posts: 4
|
Posted: Fri Jun 02, 2006 1:29 am Post subject: Load Image from Array of Bytes |
|
|
Hi all!
Exist a way to load a jpeg Image from Array of Bytes?
I try to save the array to file and after load image from file.
This method is sloooow!
I get this array from wi-fi! The time to get this array from pc is very speedly (1sec.) but the save to file is slow(10-20 sec.)
If is possible load a jpeg image directly from an Array of Byte (the time is speedly (1sec + load from array).
My Code is:
| Code: | myArrayofImage = ""
...
myArrayofImage = myArrayofImage .. socket:recv()
...
file = io.open("img.jpg","wb")
file:write(myArrayofImage)
file:close()
...
myImage = Image.load("img.jpg") |
This method is sloooow!
You know a method for don't save the image to file??
Thanks in advace!!
Stefano Russello (Creator of PSP Brew B) ) |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sat Jun 03, 2006 5:19 am Post subject: |
|
|
| cant say that I do, however if your good with elf binaries i could probably give you some code that might help. |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sun Jun 04, 2006 4:26 am Post subject: Re: Load Image from Array of Bytes |
|
|
| puffo83 wrote: | | Exist a way to load a jpeg Image from Array of Bytes? |
Yes, see the release notes of Lua Player 0.20. |
|
| Back to top |
|
 |
puffo83
Joined: 02 Jun 2006 Posts: 4
|
Posted: Mon Jun 05, 2006 7:42 am Post subject: Re: Load Image from Array of Bytes |
|
|
| Shine wrote: | | Yes, see the release notes of Lua Player 0.20. |
Creating an image from array of bytes is a new features of new Lua Player 0.20??
Really??? |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Mon Jun 05, 2006 7:55 am Post subject: Re: Load Image from Array of Bytes |
|
|
| puffo83 wrote: | Creating an image from array of bytes is a new features of new Lua Player 0.20??
Really??? |
Yes, see http://forums.ps2dev.org/viewtopic.php?t=5885 . Maybe this will be useful later when integrating physfs, too, which will allow packing all files of a game in one zip file. |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Mon Jun 05, 2006 1:11 pm Post subject: |
|
|
| any Possibility of image scaling next version? |
|
| Back to top |
|
 |
puffo83
Joined: 02 Jun 2006 Posts: 4
|
Posted: Mon Jun 05, 2006 5:21 pm Post subject: |
|
|
Great work Shine!!
Works perfectly now!
The speed is superrrrrr!!! :D
new function Image.loadFromMemory for loading images from memory:
Code:
| Code: | jpegFile = io.open("test.jpg", "rb")
data = jpegFile:read("*a")
jpegFile:close()
image = Image.loadFromMemory(data) |
PNG and JPEG is supported and autodetected |
|
| Back to top |
|
 |
MikeHaggar
Joined: 18 Jul 2005 Posts: 116
|
Posted: Tue Jun 06, 2006 2:25 am Post subject: |
|
|
| Hmm... How bout adding this for sound & music too? |
|
| Back to top |
|
 |
|