factoring wx.Image

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Feb 27 06:08:10 EST 2009


En Fri, 27 Feb 2009 00:06:47 -0200, Astan Chee <astan.chee at al.com.au>
escribió:

> I want to factor (red, green and blue at the same time) an image using  
> wx but without any GUI display or windows but it keeps crashing

What do you mean? Really crashing? Or do you get a Python stack trace?

> and if I set the checks to ignore it, it doesn't produce the images at  
> all.
> It looks like this:
>
> import wx
> img = wx.Image("star.jpg",wx.BITMAP_TYPE_BMP)

Are you sure the format is BITMAP_TYPE_BMP? The name seems to indicate
otherwise...

> factor = 1
> for i in range(1,30):
>     image = img.AdjustChannels(factor, factor, factor, 1)

And multiplying r,g,b by 30 you'll get an almost white image - is it what
you want?

>     fname = "star." + str(factor) + ".jpg"
>     img.SaveFile(fname,wx.BITMAP_TYPE_JPEG)
>     factor+=1

Note that you're saving the ORIGINAL image here...

>
> What am I missing here? What am I doing wrong? Can this even be done  
> with only wx?

Try again...

-- 
Gabriel Genellina




More information about the Python-list mailing list