I use wx.EmptyImage() to create a empty image, but this image is black.
How to create white image or change black to while.
Thanks
···
--
jiang zhixiang
I use wx.EmptyImage() to create a empty image, but this image is black.
How to create white image or change black to while.
Thanks
--
jiang zhixiang
You could try:
NameOfImage.Replace(0,0,0,255,255,255)
Gadget/Steve
On 11/09/2012 5:14 AM, Rill wrote:
I use wx.EmptyImage() to create a empty image, but this image is black.
How to create white image or change black to while.Thanks
so good
NameOfImage.Replace(0,0,0,255,255,255) can change balck to white.
Compare image quality, found wx.image is better then PIL
Thanks
2012/9/11 Gadget/Steve <GadgetSteve@live.co.uk>:
On 11/09/2012 5:14 AM, Rill wrote:
I use wx.EmptyImage() to create a empty image, but this image is black.
How to create white image or change black to while.Thanks
You could try:
NameOfImage.Replace(0,0,0,255,255,255)Gadget/Steve
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
jiang zhixiang
I wonder if wx guarantees that an EmptyImage will be all black? From the docs:
wxImage(int width, int height, bool clear=true)
Creates an image with the given width and height. If clear is true,
the new image will be initialized to black. Otherwise, the image data
will be uninitialized.
so "clear" needs to be set to True, which is the default in the Python Bindings
But for the record, other options include:
1) create a wx.MemoryDC, set teh backgroundcolor, call Clear(), and
then make an IMage form teh Bitmap.
2) use wxImage.SetData -- passing in, for instance, an array,array of
the right size, maybe something like:
import wx
import array
w, h = 3, 5
img = wx.EmptyImage(w, h, clear = False) # False to show that this works...
arr = array.array('B', (255,)) * (w * h * 3)
img.Data = arr
OK -- that is a lot more work that wx.Image.Replace().
Thanks for bringing that up!
-Chris
On Mon, Sep 10, 2012 at 11:45 PM, Rill <luckrill@gmail.com> wrote:
so good
NameOfImage.Replace(0,0,0,255,255,255) can change balck to white.
--
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
Chris.Barker@noaa.gov
Rill wrote:
so good
NameOfImage.Replace(0,0,0,255,255,255) can change balck to white.Compare image quality, found wx.image is better then PIL
It is misleading to make blanket statements like that. PIL is a huge
and enormously capable library that does vastly more than wx.Image.
Most image manipulations will be different. When you save a compressed
image, PIL allows you to specify a quality. If you didn't specify a
quality, then you can't blame the library for choosing higher compression.
Where, exactly, did you see an image quality difference?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.