Over a million developers have joined DZone.

New Camera Module

DZone's Guide to

New Camera Module

· ·
Free Resource
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
 # copy from camera.py
def take_photo(
  size=(640, 480),

So the simplest example is

import camera
im = camera.take_photo()  # use all default values

You can see what you can set on your phone

from camera import *
print image_modes()
print image_sizes()
print max_zoom()
print flash_modes()
print exposure_modes()
print white_balance_modes()


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}