Yeah, with current DMA hard drives loading uncompressed images is going to be pretty quick. Since these drives can read 20-50MB/s.
Note, that uncompressed .tga files often compress better with 7zip compression than what png files can be compressed to. However for computers where DMA isn't working, or just a slow hard drive, then compressed images will load faster. Cheers, On 1/20/07, David Gowers <[EMAIL PROTECTED]> wrote:
On 1/20/07, Bob Ippolito <[EMAIL PROTECTED]> wrote: > On 1/19/07, Kamilche <[EMAIL PROTECTED]> wrote: > > I discovered a technique for loading graphics quickly using Pygame, > > about 30x faster than a straight pygame.image.load . > > > > The gist of it is convert the picture to a string with > > > > s = pygame.image.tostring(pic, 'RGBA') > > w, h = pic.get_size() > > > > and later, when loading, use > > pygame.image.frombuffer(s, [w, h], 'RGBA') > > > > Unfortunately, I can't use it in my current project, because I need to > > access the color palette of 256 color images. I can't use this technique > > to store and load these palettized images, because images come out solid > > black. > > > > Hope this technique comes in useful to someone else tho! (Someone that > > doesn't need 256 color images.) > > That doesn't seem to make any sense... you've already loaded the > picture, why convert it to a string just to convert it back to a > picture? It's using up about the same amount of RAM as a string or as > an image object. You misunderstand I think. It looks to me like he is saying 'convert the image to a string and save that', then when loading just load the string. Which is going to be faster, of course -- no decompression or headers. It just strikes me if this kind of thing is critical then he's probably loading the images at the wrong point.