I would like to display an image, and to change its hue and saturation
while its displayed on the screen. Which classes/functions would be a
good choice for doing this?
I would like to display an image, and to change its hue and saturation
while its displayed on the screen. Which classes/functions would be a
good choice for doing this?
I'd see if PIL supports this kind of thing -- you'll find notes about converting between PIL images an wx Images in the Wiki.
-CHB
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Ah, I was hoping not to pull out the big guns for this one. I saw that wx.Image has some abilities to tweak images. Do you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably will show you enough to write your own method. I’ve used “grayOut” before and I suspect that’s pretty close to what you’re looking for. Haven’t tried using it interactively thought - it loops through every pixel in Python, so it’s probably pretty slow.
Ah, I was hoping not to pull out the big guns for this one. I saw that wx.Image has some abilities to tweak images. Do you think I can do this on pure wxPython?
Ah, I was hoping not to pull out the big guns for this one. I saw that wx.Image has some abilities to tweak images. Do you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably will show you enough to write your own method. I’ve used “grayOut” before and I suspect that’s pretty close to what you’re looking for. Haven’t tried using it interactively thought - it loops through every pixel in Python, so it’s probably pretty slow.
Ah, I was hoping not to pull out the big guns for this one. I saw that wx.Image has some abilities to tweak images. Do you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably will show you enough to write your own method. I’ve used “grayOut” before and I suspect that’s pretty close to what you’re looking for. Haven’t tried using it interactively thought - it loops through every pixel in Python, so it’s probably pretty slow.
-Nat
I looked at it and it does not look pretty… I think it (a) doesn’t let me do what I want and (b) would be too slow.
If that's not what you want then manipulating hue and saturation is basically just some math[1] performed on each pixel, and numpy does array based math really well and really fast. So one possibility would be to take a bitmap, use CopyToBuffer to put the pixel data into a numpy array, do the math using numpy magic, and then use CopyFromBuffer to move the data back into the bitmap.
I don't know what the speed would be like, but it will certainly be faster than looping over the pixels in Python code.
[1] Discovering what is the actual math to use is left as an exercise for the reader.
···
On 5/3/10 6:20 PM, cool-RR wrote:
On Mon, May 3, 2010 at 11:26 PM, cool-RR <cool-rr@cool-rr.com > <mailto:cool-rr@cool-rr.com>> wrote:
On Mon, May 3, 2010 at 11:20 PM, Nathaniel Echols > <nathaniel.echols@gmail.com <mailto:nathaniel.echols@gmail.com>> wrote:
On Mon, May 3, 2010 at 2:16 PM, cool-RR <cool-rr@cool-rr.com > <mailto:cool-rr@cool-rr.com>> wrote:
Ah, I was hoping not to pull out the big guns for this one.
I saw that `wx.Image` has some abilities to tweak images. Do
you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably
will show you enough to write your own method. I've used
"grayOut" before and I suspect that's pretty close to what
you're looking for. Haven't tried using it interactively
thought - it loops through every pixel in Python, so it's
probably pretty slow.
-Nat
I looked at it and it does not look pretty... I think it (a) doesn't
let me do what I want and (b) would be too slow.
Ram.
Since I see no easy solution I decided to give up on this task. Thanks
for helping.
Thanks Robin. The RotateHue thing is actually one of the things I wanted, but I’ll also need ability to change saturation, and I don’t want to use an external module for this one, so I think I’ll just let it go.
On Mon, May 3, 2010 at 11:20 PM, Nathaniel Echols > > <nathaniel.echols@gmail.com <mailto:nathaniel.echols@gmail.com>> wrote:
On Mon, May 3, 2010 at 2:16 PM, cool-RR <cool-rr@cool-rr.com > > <mailto:cool-rr@cool-rr.com>> wrote:
Ah, I was hoping not to pull out the big guns for this one.
I saw that `wx.Image` has some abilities to tweak images. Do
you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably
will show you enough to write your own method. I've used
"grayOut" before and I suspect that's pretty close to what
you're looking for. Haven't tried using it interactively
thought - it loops through every pixel in Python, so it's
probably pretty slow.
-Nat
I looked at it and it does not look pretty... I think it (a) doesn't
let me do what I want and (b) would be too slow.
Ram.
Since I see no easy solution I decided to give up on this task. Thanks
If that’s not what you want then manipulating hue and saturation is basically just some math[1] performed on each pixel, and numpy does array based math really well and really fast. So one possibility would be to take a bitmap, use CopyToBuffer to put the pixel data into a numpy array, do the math using numpy magic, and then use CopyFromBuffer to move the data back into the bitmap.
I don’t know what the speed would be like, but it will certainly be faster than looping over the pixels in Python code.
[1] Discovering what is the actual math to use is left as an exercise for the reader.
On Mon, May 3, 2010 at 11:20 PM, Nathaniel Echols > > > <nathaniel.echols@gmail.com <mailto:nathaniel.echols@gmail.com>> wrote:
On Mon, May 3, 2010 at 2:16 PM, cool-RR <cool-rr@cool-rr.com > > > <mailto:cool-rr@cool-rr.com>> wrote:
Ah, I was hoping not to pull out the big guns for this one.
I saw that `wx.Image` has some abilities to tweak images. Do
you think I can do this on pure wxPython?
wx.lib.imageutils has some similar functions, which probably
will show you enough to write your own method. I've used
"grayOut" before and I suspect that's pretty close to what
you're looking for. Haven't tried using it interactively
thought - it loops through every pixel in Python, so it's
probably pretty slow.
-Nat
I looked at it and it does not look pretty... I think it (a) doesn't
let me do what I want and (b) would be too slow.
Ram.
Since I see no easy solution I decided to give up on this task. Thanks
If that’s not what you want then manipulating hue and saturation is basically just some math[1] performed on each pixel, and numpy does array based math really well and really fast. So one possibility would be to take a bitmap, use CopyToBuffer to put the pixel data into a numpy array, do the math using numpy magic, and then use CopyFromBuffer to move the data back into the bitmap.
I don’t know what the speed would be like, but it will certainly be faster than looping over the pixels in Python code.
[1] Discovering what is the actual math to use is left as an exercise for the reader.
–
Robin Dunn
Thanks Robin. The RotateHue thing is actually one of the things I wanted, but I’ll also need ability to change saturation, and I don’t want to use an external module for this one, so I think I’ll just let it go.