[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] rc3 for Windows doesn't recogize PNG, JPEG and TIFF files




The rc3 binaries for Python 2.5 on Windows will not read PNG, JPEG, or TIFF files.

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.init()
(6, 0)
>>> im = pygame.image.load("testimg.jpg")
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
pygame.error: Failed loading jpeg.dll: One of the library files needed to run th
is application cannot be found.

>>>

For PNG and TIFF files it just gives an unsupported format message.

Looking at SDL_image.dll I see it has no dependencies for libtiff.dll, libpng13.dll or jpeg.dll . I also notice that libtiff.dll is linked to libjpeg.dll, a nonexistent file (I had this problem too).

This is what apparently happened. By default SDL_image is compiled to dynamically load the support libraries. ./configure will only do this if it finds the dll. It will look in /usr/local/lib for example. It found jpeg.dll. It could not find the dlls, nor the import libraries, for libtiff and libpng13, so disabled support for them. Now in doing a search for a dynamic library the directory in which SDL_image.dll resides is *not* searched automatically. Therefore the jpeg.dll in the pygame package may be ignored. In my case no jpeg.dll existed anywhere else in the dll search path so the jpeg image load failed.

I suggest forgoing dynamic loading and just link against the import libraries for jpeg.dll, libpng13 and libtiff.dll instead. The --disable-jpg-shared, --disable-png-shared and --disable-tif-shared options to ./configure do this. Now the pygame package directory is searched first, and the correct versions of jpeg.dll, etc, are found. This is how the SDL_image.dll I compiled works.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>