×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    IS there a Fast way to Make an image filter in PyS60?

    Hello everyone, I have some coding experience in Python but I'm new at PyS60.

    Now, I'm on a project as they are a Good way to learn new things dynamically.

    My target is to make an invert color filter,

    What I've done is
    Code:
    from graphics import  *
    import e32
    
    s=raw_input("Enter Image Location \n=")
    im=Image.open(s)
    img=Image.new(im.size, "L")  #my need is to make it B&W then invert
    img.blit(im)
    
    img.save("E:\\F.jpg")
    print "F.jpg has been generated"
    
    def invertclr(img2):
        width, height= img2.size
        img3=Image.new(img2.size, "L")
        for y in range(height):
           for x in range(width):
             c=img2.getpixel((x,y))[0]
             r,g,b=c
            img3.point((x,y), (255-r, 255-r, 255-r))
            #e32.ao_yield()
     img3.save("E:\\F2.jpg")
    
    invertclr(img)
    print "E:\\F2.png has been generated"
    The colors are Successfully getting inverted,
    But it takes Long times to do it
    Inventing An Image of 477x535 needed 41 seconds

    But I have an feeling that it can be done in 1 or 2 seconds,

    Actually, when I Make an B&W image an Invert its colors, and if this image is used as a mask. It creates a pretty good image filter.

    Any kind of help will be appreciated.

    EDIT: removing the e32.ao_yield inside the loop (now commented) reduced the time by 11 seconds, but its still not quite enough.

    will it run fast inside a class or a compiled script??
    Last edited by ronnie.basak96; 2012-04-30 at 08:19. Reason: Improvement

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,764

    Re: IS there a Fast way to Make an image filter in PyS60?

    There is no JIT in PyS60 as I understand, and compiled scripts affect only the loading time. You can experiment with creating C++ extensions: http://www.developer.nokia.com/Commu...Easy_Approach)

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    4

    Re: IS there a Fast way to Make an image filter in PyS60?

    Quote Originally Posted by wizard_hu_ View Post
    There is no JIT in PyS60 as I understand, and compiled scripts affect only the loading time. You can experiment with creating C++ extensions: http://www.developer.nokia.com/Commu...Easy_Approach)
    Thank you for responce.
    I am not that great in C++. So, I can't and also, That weakness in Symbian C++ led that I don't has the Carbide.c++ .

    So, I am unable to port the Ncv to PyS60 2.
    And Also, If Anyone Ports (Just Recompiling the source with PyS60 2 SDK)
    I will be thankful as In 50-60Kbps of speed I can't download 286MB.

  4. #4
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: IS there a Fast way to Make an image filter in PyS60?

    Quote Originally Posted by ronnie.basak96 View Post
    Thank you for responce.
    I am not that great in C++. So, I can't and also, That weakness in Symbian C++ led that I don't has the Carbide.c++ .

    So, I am unable to port the Ncv to PyS60 2.
    And Also, If Anyone Ports (Just Recompiling the source with PyS60 2 SDK)
    I will be thankful as In 50-60Kbps of speed I can't download 286MB.
    Good news for you :-)
    I found Ncv ported to PyS60 2.0.0 except pycamera module !

    Download it and say thanks to Marcello Bareido Almeda.

    https://projects.forum.nokia.com/pys..._PyS60_2_0.zip

    BR
    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

Similar Threads

  1. Is it possible to make a fast M3G animation with spotlights?
    By MobileVisuals in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2011-11-25, 11:12
  2. Unhandled exception filter called from program make
    By template60 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2011-02-24, 00:14
  3. Fast Image Capture
    By Tobias_80 in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2007-06-18, 12:29
  4. Fast Start Up Image
    By gjk in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-09-12, 06:31

Posting Permissions

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