You Are Here:

Community: Developer Discussion Boards

#1 Old Question Is it possible to load a 8-bit greyscale image? - 2009-01-20, 13:33

Join Date: Mar 2003
Posts: 5
yuyou
Offline
Registered User
Hi,

I want to load a 8-bit greyscale image as the mask for alpha-blending bliting. Currently the Image.load() seems only support RGB16 (and the loaded image is RGB16 even if the image file is 8-bit ). Is there a workaround?

Thanks.

Yu
Reply With Quote

#2 Old Re: Is it possible to load a 8-bit greyscale image? - 2009-01-20, 13:59

Join Date: Mar 2003
Posts: 936
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by yuyou View Post
I want to load a 8-bit greyscale image as the mask for alpha-blending bliting. Currently the Image.load() seems only support RGB16 (and the loaded image is RGB16 even if the image file is 8-bit ).
I'm surprised it works that way, but manual 1.4.5 seems to confirm this. Weird!

Quote:
Originally Posted by yuyou View Post
Is there a workaround?
There's ALWAYS a workaround Howabout this: create 8-bit image Image.new(size, mode='L') and blit your mask image on top of that? The result could be an automatically converted 8-bit image?

Good luck,

--jouni
Reply With Quote

#3 Old Re: Is it possible to load a 8-bit greyscale image? - 2009-01-20, 20:21

Join Date: Mar 2003
Posts: 5
yuyou
Offline
Registered User
Quote:
Originally Posted by JOM View Post
Howabout this: create 8-bit image Image.new(size, mode='L') and blit your mask image on top of that? The result could be an automatically converted 8-bit image?
Thanks. I did not try that one (should work) but found a way to work it out.
In order to load the 8-bit gray scale indexed image, you can create a 8-bit image object first.

img = Image(size, 'L')
# and then load the image.
img.load("c:\\data\\Images\\mask.png")
# works for Python 1.4.5 in N95 8G device.

Yu
Reply With Quote

#4 Old Re: Is it possible to load a 8-bit greyscale image? - 2009-01-21, 07:50

Join Date: Mar 2003
Posts: 936
Location: Espoo, Finland
JOM's Avatar
JOM
Offline
Forum Nokia Champion
Quote:
Originally Posted by yuyou View Post
Thanks. I did not try that one (should work) but found a way to work it out.
In order to load the 8-bit gray scale indexed image, you can create a 8-bit image object first.

Code:
img = Image(size, 'L')
# and then load the image. 
img.load("c:\\data\\Images\\mask.png")
# works for Python 1.4.5 in N95 8G device.
Thanx for tip! Seems to be same things, except faster: no blitting, just directly Image.open! Have to remember this, I'm planning to do something with 8-bit graphics == use as little memory as possible. On the other hand have to test loading times, seems like there is unnecessary conversions at background (8-bit -> 24-bit).

Cheers,

--jouni
Last edited by JOM : 2009-01-21 at 07:51. Reason: Fixed weird bug in text output ...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Icon as Image korakotc Python 6 2006-02-13 20:34
It takes time to load image on incoming call rahulsingh Symbian Tools & SDKs 16 2005-07-05 09:24
PNG Image won't load maaberge Mobile Java General 1 2003-11-16 19:13
Can I load image from the pictures list originally stored in the phone? vivian_cheng Mobile Java General 0 2003-04-28 17:41
Loading Image data from 'raw' bytes LongSteve Mobile Java General 2 2002-11-20 18:38

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ