diff options
author | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-11-02 02:05:57 (GMT) |
---|---|---|
committer | erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0> | 2007-11-02 02:05:57 (GMT) |
commit | c1464f5c02fe0d80579a3e7b09dd95696a5b0d3d (patch) | |
tree | 785b43e6a0f39a60cfeca160435fc823ac38b4e4 /utils.py | |
parent | 6eb0a98efae33390dc6c0aad1aaee81cb6628fb1 (diff) |
grayscale and other changes
git-svn-id: http://mediamods.com/public-svn/camera-activity/Record.activity@841 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -69,7 +69,18 @@ def generateThumbnail( pixbuf, scale, thumbw, thumbh ): tctx.scale(scale, scale) tctx.set_source_surface(img, 0, 0) tctx.paint() - gc.collect() - - return thumbImg
\ No newline at end of file + return thumbImg + + +def grayScalePixBuf( pb, copy ): + arr = pb.get_pixels_array() + if (copy): + arr = arr.copy() + for row in arr: + for pxl in row: + y = 0.3*pxl[0][0]+0.59*pxl[1][0]+0.11*pxl[2][0] + pxl[0][0] = y + pxl[1][0] = y + pxl[2][0] = y + return gtk.gdk.pixbuf_new_from_array(arr, pb.get_colorspace(), pb.get_bits_per_sample())
\ No newline at end of file |