Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

New camera module

A few days ago, I posted an example of how to take
a photo with py_s60 1.1.0. But now, a new and better
version (1.1.3) is released. The camera module has
improved significantly.

Now it can
- use different sizes (640x480 and 160x120 in my case)
- use zoom (0 or 1 in my case)
- take photos at 12, 16 or 24-bit color ('RGB12', 'RGB16', 'RGB')
- using flash ('none', 'auto', 'forced', 'fill_in', 'red_eye_reduce')
- set white-balance and exposure (I use 'auto' for both,
but sometimes I may use 'night' exposure)
- return an image object which can save in 'jpg' or 'png' format

You can see that these have good default values
   1   # copy from camera.py
   2  def take_photo(
   3    mode='RGB16',
   4    size=(640, 480),
   5    zoom=0,
   6    flash='none',
   7    exposure='auto',
   8    white_balance='auto'):

So the simplest example is
   1  
   2  import camera
   3  im = camera.take_photo()  # use all default values
   4  im.save(u'C:\\test.jpg')

You can see what you can set on your phone
   1  
   2  from camera import *
   3  print image_modes()
   4  print image_sizes()
   5  print max_zoom()
   6  print flash_modes()
   7  print exposure_modes()
   8  print white_balance_modes()

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS