Hi,
I am trying to make a very simple application where I will load an
image and adjust its brightness/contrast and resize it if neccesary
than before saving I will crop it to a desired dimension and print
that saved image.
Now I am using ogl.ShapeCanvas to load my images. Its working.
But before I develope this application further I want to hear your
ideas about this. My questions are:
1. Should I use ogl.ShapeCanvas for this application?
2. If not ogl than which widget should I use?
3. Is there brightness and contrast support available in wxPython?
4. Should I use PIL?
I only want to know your ideas opinion suggestions regarding this.
Thanks
Regards
There are 2 aspects to your task: Modifying the image and then displaying the resulting image. Using OGL seems like great overkill.
PIL has everything you need to do with simple calls.
wx bitmaps can be displayed by the use of a wx.PaintDC, for example.
See the attached file.
Ray
CLASS.ImageWindow.py (3.02 KB)
···
On Sat, Feb 26, 2011 at 4:47 PM, BirdaoGwra birdaogwra@gmail.com wrote:
Hi,
I am trying to make a very simple application where I will load an
image and adjust its brightness/contrast and resize it if neccesary
than before saving I will crop it to a desired dimension and print
that saved image.
Now I am using ogl.ShapeCanvas to load my images. Its working.
But before I develope this application further I want to hear your
ideas about this. My questions are:
-
Should I use ogl.ShapeCanvas for this application?
-
If not ogl than which widget should I use?
-
Is there brightness and contrast support available in wxPython?
-
Should I use PIL?
I only want to know your ideas opinion suggestions regarding this.
Hi,
Thanks for the reply. I rewrote my application and now drawing the
images with BufferDC. It loads and saves an image correctly.
I just wanted to know one more thing which I forgot to ask before.
Does PIL can change resolution of an image? Becouse wx saves it in 72
resolution which is by any means not possible to print. Or if PIL
can't than is there any other library which can do the job with wx?
Thanks
Regards
···
On Feb 27, 2:46 pm, Ray Pasco <pascor22...@gmail.com> wrote:
On Sat, Feb 26, 2011 at 4:47 PM, BirdaoGwra <birdaog...@gmail.com> wrote:
> Hi,
> I am trying to make a very simple application where I will load an
> image and adjust its brightness/contrast and resize it if neccesary
> than before saving I will crop it to a desired dimension and print
> that saved image.
> Now I am using ogl.ShapeCanvas to load my images. Its working.
> But before I develope this application further I want to hear your
> ideas about this. My questions are:
> 1. Should I use ogl.ShapeCanvas for this application?
> 2. If not ogl than which widget should I use?
> 3. Is there brightness and contrast support available in wxPython?
> 4. Should I use PIL?
> I only want to know your ideas opinion suggestions regarding this.
There are 2 aspects to your task: Modifying the image and then displaying
the resulting image. Using OGL seems like great overkill.
PIL has everything you need to do with simple calls.
wx bitmaps can be displayed by the use of a wx.PaintDC, for example.
See the attached file.
Ray
CLASS.ImageWindow.py
4KViewDownload
Hi,
Just found my answers. Now only need to implement them. PIL can
change it :).
Still, if any one would like to give me any advice, suggestions, I
would really appreciate that.
Thanks
Regards
···
On Feb 28, 4:50 am, BirdaoGwra <birdaog...@gmail.com> wrote:
Hi,
Thanks for the reply. I rewrote my application and now drawing the
images with BufferDC. It loads and saves an image correctly.
I just wanted to know one more thing which I forgot to ask before.
Does PIL can change resolution of an image? Becouse wx saves it in 72
resolution which is by any means not possible to print. Or if PIL
can't than is there any other library which can do the job with wx?
Thanks
Regards
On Feb 27, 2:46 pm, Ray Pasco <pascor22...@gmail.com> wrote:
> On Sat, Feb 26, 2011 at 4:47 PM, BirdaoGwra <birdaog...@gmail.com> wrote:
> > Hi,
> > I am trying to make a very simple application where I will load an
> > image and adjust its brightness/contrast and resize it if neccesary
> > than before saving I will crop it to a desired dimension and print
> > that saved image.
> > Now I am using ogl.ShapeCanvas to load my images. Its working.
> > But before I develope this application further I want to hear your
> > ideas about this. My questions are:
> > 1. Should I use ogl.ShapeCanvas for this application?
> > 2. If not ogl than which widget should I use?
> > 3. Is there brightness and contrast support available in wxPython?
> > 4. Should I use PIL?
> > I only want to know your ideas opinion suggestions regarding this.
> There are 2 aspects to your task: Modifying the image and then displaying
> the resulting image. Using OGL seems like great overkill.
> PIL has everything you need to do with simple calls.
> wx bitmaps can be displayed by the use of a wx.PaintDC, for example.
> See the attached file.
> Ray
> CLASS.ImageWindow.py
> 4KViewDownload
Hi,
Just found my answers. PIL can do it :). Now just need to implement
them.
Still, if anyone would like to give me any opinion, suggestions, I
would really appreciate that.
Thanks
Regards
···
On Feb 28, 4:50 am, BirdaoGwra <birdaog...@gmail.com> wrote:
Hi,
Thanks for the reply. I rewrote my application and now drawing the
images with BufferDC. It loads and saves an image correctly.
I just wanted to know one more thing which I forgot to ask before.
Does PIL can change resolution of an image? Becouse wx saves it in 72
resolution which is by any means not possible to print. Or if PIL
can't than is there any other library which can do the job with wx?
Thanks
Regards
On Feb 27, 2:46 pm, Ray Pasco <pascor22...@gmail.com> wrote:
> On Sat, Feb 26, 2011 at 4:47 PM, BirdaoGwra <birdaog...@gmail.com> wrote:
> > Hi,
> > I am trying to make a very simple application where I will load an
> > image and adjust its brightness/contrast and resize it if neccesary
> > than before saving I will crop it to a desired dimension and print
> > that saved image.
> > Now I am using ogl.ShapeCanvas to load my images. Its working.
> > But before I develope this application further I want to hear your
> > ideas about this. My questions are:
> > 1. Should I use ogl.ShapeCanvas for this application?
> > 2. If not ogl than which widget should I use?
> > 3. Is there brightness and contrast support available in wxPython?
> > 4. Should I use PIL?
> > I only want to know your ideas opinion suggestions regarding this.
> There are 2 aspects to your task: Modifying the image and then displaying
> the resulting image. Using OGL seems like great overkill.
> PIL has everything you need to do with simple calls.
> wx bitmaps can be displayed by the use of a wx.PaintDC, for example.
> See the attached file.
> Ray
> CLASS.ImageWindow.py
> 4KViewDownload
WxPython can also easily resize an image, but doesn’t have features for changing the contrast.
PythonMagick is a wxPython interface to the ImageMagick image processing library. It’s very similar to PIL, but has some different higher level capabilities. Like PIL, it’s largely written in C and so is also very fast.
For what you want, either package will be more than adequate.
Ray
···
On Feb 28, 11:38 am, BirdaoGwra birdaog...@gmail.com wrote:
Hi,
Just found my answers. Now only need to implement them. PIL can
change it :).
Still, if any one would like to give me any advice, suggestions, I
would really appreciate that.
Thanks
Regards
Hi,
I just implemented the brightness/contrast from PIL enhancer module.
Yesterday I downloaded the PythonMagick. But I don't understand how
to install it. It is
a zip file. I tryed to find msi, but could not. Thats why I use PIL.
Now I have to implement a print method. Could you kindly give me
some idea regarding
printing images from wx. I am trying to understand the demo "Scrolled
Window.py"
Thanks
Regards
···
On Feb 28, 1:03 pm, Ray Pasco <pascor22...@gmail.com> wrote:
On Feb 28, 11:38 am, BirdaoGwra <birdaog...@gmail.com> wrote:
> Hi,
> Just found my answers. Now only need to implement them. PIL can
> change it :).
> Still, if any one would like to give me any advice, suggestions, I
> would really appreciate that.
> Thanks
> Regards
WxPython can also easily resize an image, but doesn't have features for
changing the contrast.
*PythonMagick* <http://www.imagemagick.org/script/api.php#python> is a
wxPython interface to the *ImageMagick* image processing library. It's very
similar to PIL, but has some different higher level capabilities. Like PIL,
it's largely written in C and so is also very fast.
For what you want, either package will be more than adequate.
Ray
Hi Ray,
Here is a code:
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
Is this right way to do this? Cos it is not working with
transparent images like gif or png!
Thanks
Regards
···
On Feb 28, 1:22 pm, BirdaoGwra <birdaog...@gmail.com> wrote:
Hi,
I just implemented the brightness/contrast from PIL enhancer module.
Yesterday I downloaded the PythonMagick. But I don't understand how
to install it. It is
a zip file. I tryed to find msi, but could not. Thats why I use PIL.
Now I have to implement a print method. Could you kindly give me
some idea regarding
printing images from wx. I am trying to understand the demo "Scrolled
Window.py"
Thanks
Regards
On Feb 28, 1:03 pm, Ray Pasco <pascor22...@gmail.com> wrote:
> On Feb 28, 11:38 am, BirdaoGwra <birdaog...@gmail.com> wrote:
> > Hi,
> > Just found my answers. Now only need to implement them. PIL can
> > change it :).
> > Still, if any one would like to give me any advice, suggestions, I
> > would really appreciate that.
> > Thanks
> > Regards
> WxPython can also easily resize an image, but doesn't have features for
> changing the contrast.
> *PythonMagick* <http://www.imagemagick.org/script/api.php#python> is a
> wxPython interface to the *ImageMagick* image processing library. It's very
> similar to PIL, but has some different higher level capabilities. Like PIL,
> it's largely written in C and so is also very fast.
> For what you want, either package will be more than adequate.
> Ray
Hi Ray,
Sorry for the post. It works. My format was wrong.
Regards
···
On Feb 28, 2:50 pm, BirdaoGwra <birdaog...@gmail.com> wrote:
Hi Ray,
Here is a code:
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
Is this right way to do this? Cos it is not working with
transparent images like gif or png!
Thanks
Regards
On Feb 28, 1:22 pm, BirdaoGwra <birdaog...@gmail.com> wrote:
> Hi,
> I just implemented the brightness/contrast from PIL enhancer module.
> Yesterday I downloaded the PythonMagick. But I don't understand how
> to install it. It is
> a zip file. I tryed to find msi, but could not. Thats why I use PIL.
> Now I have to implement a print method. Could you kindly give me
> some idea regarding
> printing images from wx. I am trying to understand the demo "Scrolled
> Window.py"
> Thanks
> Regards
> On Feb 28, 1:03 pm, Ray Pasco <pascor22...@gmail.com> wrote:
> > On Feb 28, 11:38 am, BirdaoGwra <birdaog...@gmail.com> wrote:
> > > Hi,
> > > Just found my answers. Now only need to implement them. PIL can
> > > change it :).
> > > Still, if any one would like to give me any advice, suggestions, I
> > > would really appreciate that.
> > > Thanks
> > > Regards
> > WxPython can also easily resize an image, but doesn't have features for
> > changing the contrast.
> > *PythonMagick* <http://www.imagemagick.org/script/api.php#python> is a
> > wxPython interface to the *ImageMagick* image processing library. It's very
> > similar to PIL, but has some different higher level capabilities. Like PIL,
> > it's largely written in C and so is also very fast.
> > For what you want, either package will be more than adequate.
> > Ray
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
Is this right way to do this? Cos it is not working with
transparent images like gif or png!
This is really a question for the PIL list, but:
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
this lookslike yuo are creating a PIL image with an alpha channel.
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
and this looks like you are creating a alpha channel -- maybe it it writing over the alpha channel you started with?
It's also possible that wx isn't respecting the alpha channel.
I'd experiment with pure PIL to test things out -- reading an writing PNGs, and make sure it's doing what you want, then worry about how to display in wx.
-Chris
···
On 2/28/11 2:50 PM, BirdaoGwra wrote:
--
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
Hi Christopher,
Actually this code works but only with some images of same formats.
May be Ray would tell something about this.
Thanks
Regards
···
On Feb 28, 3:03 pm, Christopher Barker <Chris.Bar...@noaa.gov> wrote:
On 2/28/11 2:50 PM, BirdaoGwra wrote:
> im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
> self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
> createAlpha=True)
> Is this right way to do this? Cos it is not working with
> transparent images like gif or png!
This is really a question for the PIL list, but:
> im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
this lookslike yuo are creating a PIL image with an alpha channel.
> self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
> createAlpha=True)
and this looks like you are creating a alpha channel -- maybe it it
writing over the alpha channel you started with?
It's also possible that wx isn't respecting the alpha channel.
I'd experiment with pure PIL to test things out -- reading an writing
PNGs, and make sure it's doing what you want, then worry about how to
display in wx.
-Chris
--
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.Bar...@noaa.gov
I did some work on printing images, I made some Printout sub-classes that take a canvas (wx.Bitmap) and print it. I have Full page, half page and wallet size implemented. They are not perfect and do need improving, but they could be a good starting point. I have tested them somewhat and all they need is some tweaking. If you want them, just say so
···
–
Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!
BirdaoGwra wrote:
Hi Christopher,
Actually this code works but only with some images of same formats.
I suspect you want to load the image with PIL, then convert it to RGB (or RGBA), then proceed from there.
-Chris
···
May be Ray would tell something about this.
Thanks
Regards
On Feb 28, 3:03 pm, Christopher Barker <Chris.Bar...@noaa.gov> wrote:
On 2/28/11 2:50 PM, BirdaoGwra wrote:
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
Is this right way to do this? Cos it is not working with
transparent images like gif or png!
This is really a question for the PIL list, but:
im = ImgConv.PilImageFromWxImage(self.img, wantAlpha=True)
this lookslike yuo are creating a PIL image with an alpha channel.
self.window.image1 = ImgConv.WxImageFromPilImage(bright_im,
createAlpha=True)
and this looks like you are creating a alpha channel -- maybe it it
writing over the alpha channel you started with?
It's also possible that wx isn't respecting the alpha channel.
I'd experiment with pure PIL to test things out -- reading an writing
PNGs, and make sure it's doing what you want, then worry about how to
display in wx.
-Chris
--
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.Bar...@noaa.gov
--
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
That’s exactly right. Wx does not always properly read images with alpha plane (variable) transparency. So, read in all image files with PIL and then convert to a wx.bitmap or wx.image when done processing it with PIL.
You seem to have located my image conversion library which makes PIL <==> WX image format conversions simple.
Ray
ImgConv.py (5.45 KB)
···
On Feb 28, 11:17 pm, Christopher Barker Chris.Bar...@noaa.gov wrote:
BirdaoGwra wrote:
Hi Christopher,
Actually this code works but only with some images of same formats.
I suspect you want to load the image with PIL, then convert it to RGB
(or RGBA), then proceed from there.
-Chris
@Micah Nordland:
That will be really helpfull. kindly attach the file :).
@Ray:
Actually I don't need transparency in my application. It will only
load and save jpg or base64(for back up) and directly print out the
image. But I asked for clearing my doubts. Thank you for your module.
Thanks
Regards
···
On Feb 28, 11:45 pm, Ray Pasco <pascor22...@gmail.com> wrote:
On Feb 28, 11:17 pm, Christopher Barker <Chris.Bar...@noaa.gov> wrote:
> BirdaoGwra wrote:
> > Hi Christopher,
> > Actually this code works but only with some images of same formats.
> I suspect you want to load the image with PIL, then convert it to RGB
> (or RGBA), then proceed from there.
> -Chris
That's exactly right. Wx does not always properly read images with alpha
plane (variable) transparency. So, read in all image files with PIL and then
convert to a wx.bitmap or wx.image when done processing it with PIL.
You seem to have located my image conversion library which makes PIL <==> WX
image format conversions simple.
Ray
ImgConv.py
7KViewDownload
@ Cristopher:
I am loading the image with wx. Than converting it to pil so that I
can use some module from it to modify the image like brightness/
contrast/sharpness etc.
Thanks
Regards
···
On Feb 28, 11:45 pm, Ray Pasco <pascor22...@gmail.com> wrote:
On Feb 28, 11:17 pm, Christopher Barker <Chris.Bar...@noaa.gov> wrote:
> BirdaoGwra wrote:
> > Hi Christopher,
> > Actually this code works but only with some images of same formats.
> I suspect you want to load the image with PIL, then convert it to RGB
> (or RGBA), then proceed from there.
> -Chris
That's exactly right. Wx does not always properly read images with alpha
plane (variable) transparency. So, read in all image files with PIL and then
convert to a wx.bitmap or wx.image when done processing it with PIL.
You seem to have located my image conversion library which makes PIL <==> WX
image format conversions simple.
Ray
ImgConv.py
7KViewDownload
Here you go, I also added a dialog that works with the classes, it’s not necessary for them to work, but it just makes having the user pick which size he wants easier. Also, You can test these without wasting paper by using pdf creator on windows, and with cups-pdf on ubuntu. for cups-pdf just make sure to have a “PDF” (caps necessary) in your home folder. cups-pdf probably exists on other distros, but I don’t know the package name.
ImagePrint.py (9.15 KB)
···
–
Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I just massacred you!!!
@Micah:
Thank you for the file. I will add it to my application and try to
make some other classes for our custom page sizes. Once I will add the
print class my first version will be complete. After that I will
update the application as necessary.
And thanks to all who gave me their opinion, suggestions here to
help me make my application.
Thank you very much.
Regards
···
On Mar 1, 6:06 am, Micah Nordland <mpnordl...@gmail.com> wrote:
Here you go, I also added a dialog that works with the classes, it's
not necessary for them to work, but it just makes having the user pick which
size he wants easier. Also, You can test these without wasting paper by
using pdf creator on windows, and with cups-pdf on ubuntu. for cups-pdf just
make sure to have a "PDF" (caps necessary) in your home folder. cups-pdf
probably exists on other distros, but I don't know the package name.
--
Hi, I will kill all ads in google gmail.
They will all be dead and gone for all my emails to you. HA HA bye bye ads I
just massacred you!!!
ImagePrint.py
12KViewDownload
You originally said you needed to make contrast adjustments and that
you are using PIL to do that. If you don't want or need to work with
transparency then ignore transparency.
Like I said before, it's easiest to read an image file with PIL,
modify it with PIL then convert it to a wx.image or wx.bitmap. Both
PIL and the image conversion routines also work just as well on images
without transparency. The conversion routines add a transparency
channel by default unless you tell it not to, but the image will
remain 100% opaque and appear exactly the same as the original source
image. I.e., RGB ==> RGBA unless you set wantAlpha=False for calls to
WxBitmapFromPilImage() and WxImageFromPilImage().
···
On Mar 1, 4:40 am, BirdaoGwra <birdaog...@gmail.com> wrote:
Actually I don't need transparency in my application. It will only
load and save jpg or base64(for back up) and directly print out the
image. But I asked for clearing my doubts. Thank you for your module.
Hi Ray,
Before modifying the image I have to draw it on dc so that I(or
someone) can see the image. There are two sliders to adjust the
brightness/contrast. That's why I am reading the image with wx than
converting it into pil for the b/c adjustment. Than again converting
it into wx to redraw. Isn't it right way to do this?
Thanks
Regards
···
On Mar 1, 3:02 pm, Ray Pasco <pascor22...@gmail.com> wrote:
On Mar 1, 4:40 am, BirdaoGwra <birdaog...@gmail.com> wrote:
> Actually I don't need transparency in my application. It will only
> load and save jpg or base64(for back up) and directly print out the
> image. But I asked for clearing my doubts. Thank you for your module.
You originally said you needed to make contrast adjustments and that
you are using PIL to do that. If you don't want or need to work with
transparency then ignore transparency.
Like I said before, it's easiest to read an image file with PIL,
modify it with PIL then convert it to a wx.image or wx.bitmap. Both
PIL and the image conversion routines also work just as well on images
without transparency. The conversion routines add a transparency
channel by default unless you tell it not to, but the image will
remain 100% opaque and appear exactly the same as the original source
image. I.e., RGB ==> RGBA unless you set wantAlpha=False for calls to
WxBitmapFromPilImage() and WxImageFromPilImage().