I have SDL2 and SDL2_image packages installed. Here is the code I'm using:
Code:
sdl2.ext.init()
window = sdl2.ext.Window("SDL2 Image Test", size=(800, 600))
window.show()
renderer = sdl2.ext.Renderer(window, -1, 0)
image = sdl2.ext.load_image("test_img.jpg") # <--- ERROR
running = True
while running:
events = sdl2.ext.get_events()
for event in events:
if event.type == sdl2.SDL_QUIT:
running = False
break
window.refresh()
and it gives the following output:
Code:
Traceback (most recent call last):
File "sdlimg", line 24, in <module>
main()
File "sdlimg", line 12, in main
image = sdl2.ext.load_image("test_img.jpg")
File "/usr/lib64/python3.5/site-packages/sdl2/ext/image.py", line 71, in load_image
raise SDLError(sdlimage.IMG_GetError())
sdl2.ext.common.SDLError: b'JPEG loading error'
I tried searching the error and got literally no results. I also tried sdl2.sdlimage.IMG_Load() instead but then it simply gives a "wrong type" error. I tested with BMP files and they load fine.
So anyone have any ideas why it fails to load JPG images?
-
Or if there is another way to achieve hardware-accelerated image rendering in python that integrates well with PyGObject/GTK then I'd like to hear about it.
Thanks