Duncan Webb wrote:
> Duncan Webb wrote:
>> Jason Tackaberry wrote:
>>> On Fri, 2006-12-15 at 22:12 +0100, Duncan Webb wrote:
>>>> Ignore this, the problem is in the call:
>>>> src/audio/plugins/coversearch.py:
>>>> image = Image.open(cStringIO.StringIO(n.read()))
>>>>
>>>> Should be asking is there an imlib equivalent?
>>> If n is a file object, I'm not sure why that isn't just Image.open(n),
>>> but in any case the imlib2 equivalent would be something like:
>>>
>>> image = imlib2.open_from_memory(n.read())
>> How do I now detect that it is an image?
>>
>> item.image is a <kaa.imlib2.image.Image object at 0xaf78378c>
>>
>> Before:
>> if isinstance(item.image, Image.Image):
>> image = osd.loadbitmap(item.image)
>
> That was rubbish, as it must be working :(
>
> in skins/main/skin_utils.py
> if item.image:
> - if isinstance(item.image, ImageFile.ImageFile):
> + if isinstance(item.image, Image.Image):
> image = osd.loadbitmap(item.image)
> else:
> image = load_imagecache['thumb://%s' % item.image]
>
> so it was calling osd.py with an image which is trying to do:
> try:
> image = pygame.image.fromstring(url.tostring(), url.size,
> url.mode)
> except:
> if url[:8] == 'thumb://':
>
> Does this mean that PIL's ImageFile format is a url, instead of an image?
I figured it out :D
url is sometimes an image object :(, so the exception was being caused
by the tostring() call, as it always fails with kaa.imlib2 and the
exception is a bit too general, catch everything. :(
This is what I've done, but it might need a clean up a bit.
try:
- image = pygame.image.fromstring(url.tostring(), url.size,
url.mode)
- except:
+ if url.mode == 'BGRA':
+ url.mode = 'RGBA'
+ image =
pygame.image.fromstring(str(url.get_raw_data(format=url.mode)),
url.size, url.mode)
+ except Exception, e:
+ print e
Duncan
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel