Fast gamma correction for wxPython
Robin Dunn
robin at alldunn.com
Fri Nov 2 08:56:59 PDT 2007
Noel wrote:
> Hello everybody!
>
> Most image viewer applications have a need for gamma or colour
> correction. Since a gamma correcion is usually applied to every image
> it should be reasonably fast. Unfortunately using
> wx.Image.GetDataBuffer() manipulation the data and setting it in
> wx.Image.SetDataBuffer is much (5 times slower in my case) slower then
> a C++ solution. For a modern digital photography it can take seconds.
>
> I did a patch but the function is so generic that I have to admit it
> is argueable if it makes sense in the C++ distribution of wxWidgets
> (even so it can adjust all colour channels including the alpha channel
> eg. for fade-in fade-out effects). However, IMHO it would be a benefit
> for wxPython because of the speed advantage.
>
> Should/Could it be moved to _image.i in wxPython?
Yes, it's possible. The code will need to be slightly rewritten.
Instead of being a C++ method it will need to be written as if it is an
external function that accepts a "wxImage* self" parameter and uses only
the public members of wxImage. I can then fold it in such that it
appears to be a method of the Python class.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wx-users
mailing list