You Are Here:

Community: Developer Discussion Boards

#1 Old Mask, Images - 2008-10-30, 12:00

Join Date: Oct 2008
Posts: 24
BAM8
Offline
Registered User
Hello! I´m having a problem debugging the following script:
------------------------------------
import appuifw, graphics, e32, key_codes
mask_img = graphics.Image.new(size=(50,50), mode='1')
mask_img.load(u"E:\\Python\\mask_img.png")
src_img = graphics.Image.open(u"E:\\Python\\orig_img.png")
-------------------------------------

I have in that directory a file called orig_img.png .
The error is:

File "c:\resource\graphics.py", line 104, in load

self._image.load(self._filename, self_callback)
SymbianError:[Errno -1]

Bye!
kErrNotFound
Reply With Quote

#2 Old Re: Mask, Images - 2008-10-30, 15:15

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Hi,
Is this a complete code or a part of the code?


Jajal Mehul
Reply With Quote

#3 Old Re: Mask, Images - 2008-10-30, 18:03

Join Date: Oct 2008
Posts: 24
BAM8
Offline
Registered User
The script follows this way:

canvas = appuifw.Canvas()
appuifw.app.body = canvas
canvas.blit(src_img, target=(0,0), source=(0,0), mask = mask_img)

but I became an error when loading the file "mask_img.png".

Bye!
Reply With Quote

#4 Old Re: Mask, Images - 2008-10-30, 19:13

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Hi BAM8
Try this code it is working with my phone
Code:
import graphics
import e32
import appuifw
can=appuifw.Canvas()
appuifw.app.body=can
m=graphics.Image.new(size=(585,834), mode='1')
i=graphics.Image.open("e:\\1.jpg")
m.load("e:\\2.jpg")

can.blit(i,target=(0,0),source=(0,0),mask=m)
e32.ao_sleep(5)
i think in your case while you create a new image for mask its size should be same as the size of the image that you are gng to load.


Jajal Mehul
Reply With Quote

#5 Old Re: Mask, Images - 2008-10-30, 19:19

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Hi,
Have you check the size of the file mask_img.?
It should be (50,50) because you create a new image with that size.


Jajal Mehul
Reply With Quote

#6 Old Re: Mask, Images - 2008-10-30, 20:03

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by BAM8 View Post
Hello! I´m having a problem debugging the following script:
------------------------------------
import appuifw, graphics, e32, key_codes
mask_img = graphics.Image.new(size=(50,50), mode='1')
mask_img.load(u"E:\\Python\\mask_img.png")
src_img = graphics.Image.open(u"E:\\Python\\orig_img.png")
-------------------------------------

I have in that directory a file called orig_img.png .
The error is:

File "c:\resource\graphics.py", line 104, in load

self._image.load(self._filename, self_callback)
SymbianError:[Errno -1]

Bye!
kErrNotFound

Hi BAM8,

Well, I have answered this same question some days ago. Take a look at this thread. And next time, please use the search function of the DiBo to see if your question has been answered before creating a new thread. Then, we won't have repeated threads and the forum will be cleaner

EDIT: I also made an article on the Wiki for getting things easier.


BR,

Rafael.
Last edited by Rafael T. : 2008-10-30 at 21:16.
Reply With Quote

#7 Old Re: Mask, Images - 2008-10-31, 11:08

Join Date: Oct 2008
Posts: 24
BAM8
Offline
Registered User
Hello! Thank you, I had a problem with the size of the file but now... I have another problem, if I don´t create a file called mask_img.png and paste it in the directory , it returns an error and if I create it the image doesn´t change, that´s to say, in the mask_img.png I don´t have a copy of src_img. Bye!
Reply With Quote

#8 Old Re: Mask, Images - 2008-10-31, 15:44

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Hi,
i cant get your problem. Can you please explain it in detail?


Jajal Mehul
Reply With Quote

#9 Old Re: Mask, Images - 2008-10-31, 17:07

Join Date: Oct 2008
Posts: 24
BAM8
Offline
Registered User
Hello! Yes,of course, I can explain it in detail: The problem now is that if I don´t create a file called "mask_img.png" I get an error, but if I create it, I don´t get an error but I don´t get the result I want, because with the script I should get an image in black and white, a mask.
My script is:

-------------------------------------------------
import graphics, e32, appuifw

mask_img = graphics.Image.new(size=(675,900), mode='1')
mask_img.load(u"E:\\Python\\mask_img.png")
src_img = graphics.Image.open(u"E:\\Python\\orig_img.png")
canvas = appuifw.Canvas()
appuifw.app.body = canvas
canvas.blit(src_img, target=(0,0), source=(0,0), mask = mask_img)

---------------------------------------------------
Reply With Quote

#10 Old Re: Mask, Images - 2008-10-31, 18:09

Join Date: Feb 2008
Posts: 743
Location: Belo Horizonte, Brazil
Send a message via Skype™ to Rafael T.
Rafael T.'s Avatar
Rafael T.
Offline
Forum Nokia Champion
Quote:
Originally Posted by BAM8 View Post
Hello! Yes,of course, I can explain it in detail: The problem now is that if I don´t create a file called "mask_img.png" I get an error, but if I create it, I don´t get an error but I don´t get the result I want, because with the script I should get an image in black and white, a mask.
My script is:

-------------------------------------------------
import graphics, e32, appuifw

mask_img = graphics.Image.new(size=(675,900), mode='1')
mask_img.load(u"E:\\Python\\mask_img.png")
src_img = graphics.Image.open(u"E:\\Python\\orig_img.png")
canvas = appuifw.Canvas()
appuifw.app.body = canvas
canvas.blit(src_img, target=(0,0), source=(0,0), mask = mask_img)

---------------------------------------------------
Hi BAM8,

Are you sure your mask is the same size of your main image? I would try a smaller image for testing. Try something like a B&W icon first - size 40,40; for example



BR,

Rafael.
Reply With Quote

#11 Old Re: Mask, Images - 2008-10-31, 18:25

Join Date: Sep 2007
Posts: 395
Location: Bhavnagar
Send a message via Yahoo to james1980
james1980's Avatar
james1980
Offline
Forum Nokia Champion
Hi,
I agree with rafael , you should try it with some small image. Second thing make sure that your mask img and source img should be of the same size. You can try to resize your image so that full img is display on the canvas. Otherwise i dont think there is any problem in your script now.


Jajal Mehul
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
Generating Bitmap Mask for PNG images deepchand86 General Symbian C++ 1 2008-09-24 09:17
Generatin Bitmap Mask for PNG images deepchand86 General Symbian C++ 3 2008-09-24 08:57
Listbox里icon显示和释放的问题! tianray Symbian 3 2008-09-24 03:40
Incorrect rgb values for jpg images on S40 3rd ed bjudfar Mobile Java Media (Graphics & Sounds) 8 2007-05-29 17:34
Help with creating Images..Pls rj_cybersilver Mobile Java Media (Graphics & Sounds) 0 2005-03-02 02:58

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