Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User phil232fm's Avatar
    Join Date
    Dec 2008
    Posts
    3
    Hi

    Using the camera example for python here I added
    actual code to the buffer callback to actually save a picture, like so:

    Code:
    def buffer_cb(self, element, buffer, pad):
            if self.picture_taken:
                self.picture_taken = False
                print "picture taken"
                image = Image.fromstring("P", (640,480), buffer)
                image = image.convert("RGB")
                image.save("picture.jpg")
                
            return True
    The problem is that the picture turns out in grayscale. If I set the mode for the fromstring method to "RGB" or "CMYK" it gives a "ValueError: not enough image data" error, and only the "P" mode seems to work. This seems odd as looking at the size of the buffer recieved (as a string) it is definately big enough for a colour image at 640*480. Does anyone have any clue what's going on?

    Thanks in advance
    Last edited by phil232fm; 2008-12-11 at 20:29. Reason: missed model in title

  2. #2
    Super Contributor jethro.fn's Avatar
    Join Date
    May 2004
    Location
    Tampere, Finland
    Posts
    524
    You may need to configure the raw decoder to match the input format (see the raw decoder documentation):

    Code:
    image = Image.fromstring("RGB", (640, 480), buffer, "raw", "RGB", 0)
    Experiment with the raw mode and stride parameters to get a correct image.

    By the way, this forum is mainly populated by people who use PyS60 (Python for S60 phones). Maemo-specific questions probably get more answers on maemo.org developer mailing list or internettablettalk.com (soon to be called talk.maemo.org) forums.

Similar Threads

  1. Cellphones challenge cameras with sharper pictures
    By jennyyu in forum General Development Questions
    Replies: 0
    Last Post: 2008-06-18, 09:23
  2. Disable camera
    By Asmodeusz in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2008-04-30, 10:02
  3. embedable camera application??
    By zhengyu97 in forum Symbian C++
    Replies: 0
    Last Post: 2005-04-22, 11:09
  4. 7710 MMAPI camera snapsot gives low res pictures
    By akmits in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-03-09, 22:31
  5. Compatibility problems with camera API on 6600
    By fredrik99 in forum Symbian C++
    Replies: 3
    Last Post: 2003-12-10, 03:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved