LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-14-2016, 08:14 AM   #1
ahc_fan
Member
 
Registered: Jan 2009
Location: Seattle, WA
Distribution: Slackware64 14.2
Posts: 259

Rep: Reputation: 11
PySDL2 error loading jpeg


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

Last edited by ahc_fan; 02-14-2016 at 08:18 AM.
 
Old 02-15-2016, 08:24 AM   #2
ahc_fan
Member
 
Registered: Jan 2009
Location: Seattle, WA
Distribution: Slackware64 14.2
Posts: 259

Original Poster
Rep: Reputation: 11
Still struggling with this error. I tried registering at SDL forums but apparently I'm not authorized to create topics there. I tried uninstalling sdl2, sdl2_image, pysdl2 and reinstalling them all in that order plus dependencies. Still the same, uninformative error...
 
Old 02-15-2016, 11:51 AM   #3
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
The obvious questions: is test_img.jpg a valid jpeg? If so, is it in the same directory as the executable?


EDIT: Nevermind. Just tried it and get different errors.

Last edited by norobro; 02-15-2016 at 12:33 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grun Loading stage 1.5, Grub loading - Error 22, won't boot from bootdisk susancorless Linux - Newbie 7 12-06-2010 10:51 PM
[SOLVED] retrieving jpeg files from BkUp copy yields:ERR INTERPRETING JPEG; file not jpeg, drmjh Linux - General 7 10-03-2010 08:13 AM
error loading operating system virtual box loading vmware xp the_ultimate_samurai Linux - Virtualization and Cloud 2 02-09-2010 03:25 PM
error converting jpeg to ai file aeshj Linux - General 3 10-16-2007 10:28 AM
Loading modules error after loading compiled kernel td0l2 Linux - Newbie 12 07-28-2004 11:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration