AW: wxDC - Standalone and with CGI?

Hi Stuart,
I didn't consider yet. As i began the project i was lucky to set up a double
buffered drawing framework so easily with wxPython. The idea about the
server sided image creation came up much later. Do you know drawing
libraries which can be used to draw and show images in an interactive
window? I know ImageMagick but i heard this project was nearly dead.
Oliver

···

-----Ursprüngliche Nachricht-----
Von: Stuart [mailto:stuartw@kcbbs.gen.nz]
Gesendet: Mittwoch, 3. Dezember 2003 11:11
An: wxPython-users@lists.wxwindows.org
Betreff: Re: [wxPython-users] wxDC - Standalone and with CGI?

On Wednesday 03 December 2003 22:51, Oliver Walczak wrote:

Dear List,
Is it possible to use wxPython in a server sided CGI script? I always get
an error message that no graphic device handle could be opened when i
import with from wxPython import *. I need to create images with the wxDC
drawing functions and save the image buffer to an image file on HD.
How can i do that? Is there another approach to do this? My drawing
routines are all finished. I need to show the resulting images in a
standalone wxPython application (very interactive, not still images) as
well as to create them with the CGI script.
Oliver

I would suggest if you absolutly need to use GDI drawing of some form to
write
a drawing 'server' process that communicated with the CGI level through a
comms protocol (XMLRPC tend to be quite easy) or even through a file system
approach - you will almost certainly need to serialise the access to this
server.

I doubt it is possible to initialise wx in the context of CGI - but I could
be
wrong.

Have you considered using other less GUI-oriented drawing libraries?

Regards,
Stuart

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Oliver Walczak wrote:

I didn't consider yet. As i began the project i was lucky to set up a double
buffered drawing framework so easily with wxPython. The idea about the
server sided image creation came up much later. Do you know drawing
libraries which can be used to draw and show images in an interactive
window? I know ImageMagick but i heard this project was nearly dead.
Oliver

A few ideas:

1) What platform are you on? on *nix, you need to have an Xserver
running for wxWindows to connect to when it initializes. However, I
recall a suggestion on this mailing list a good while back that there is
a headless X server around that does nothing but look like an Xserver to
X clients, and you could run that on your server, and wxWindows would
think it was talking to a GUI. I'll probably try to get this working
myslef in the next few months, but havn't yet. A search of the web
should turn up what you need.

2) PIL should work fine as well, though with a different API that a DC.

3) PythonMagic does look viable...is it really dying?

4) The SciPy/Chaco folks are using Antigrain: for their bitmap
rendering...it should produce very nice output.:
http://www.antigrain.com/

They have presumably written python wrapper for it, as Chaco is Python
project. I don't know how hard it would be to use them by themsleves,
but it's worth checking out. They are focusing on Windows at the moment,
so you're likely to have more work to so on other platforms, but their
goal is cross platform support, so it shouldn't be too hard.

Please let us know what you come up with..others have had the saem
issues.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (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

Chris Barker wrote:

Oliver Walczak wrote:

I didn't consider yet. As i began the project i was lucky to set up a double
buffered drawing framework so easily with wxPython. The idea about the
server sided image creation came up much later. Do you know drawing
libraries which can be used to draw and show images in an interactive
window? I know ImageMagick but i heard this project was nearly dead.
Oliver
   
3) PythonMagic does look viable...is it really dying?

Actually PythonMagick is alive and well. The web site is up and running again. I'm using PythonMagick regularly and it works great. To get to it, just get on wxPyWiki and search for PythonMagick. Let me know if you have any questions.

Regards,
Bob

Chris Barker wrote:

Oliver Walczak wrote:

I didn't consider yet. As i began the project i was lucky to set up a double
buffered drawing framework so easily with wxPython. The idea about the
server sided image creation came up much later. Do you know drawing
libraries which can be used to draw and show images in an interactive
window? I know ImageMagick but i heard this project was nearly dead.
Oliver

A few ideas:

1) What platform are you on? on *nix, you need to have an Xserver
running for wxWindows to connect to when it initializes. However, I
recall a suggestion on this mailing list a good while back that there is
a headless X server around that does nothing but look like an Xserver to
X clients, and you could run that on your server, and wxWindows would
think it was talking to a GUI. I'll probably try to get this working
myslef in the next few months, but havn't yet. A search of the web
should turn up what you need.

It's Xvnc, part of the vncserver or tightvnc package depending on your distro.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Chris Barker wrote:

Oliver Walczak wrote:

[snip]

recall a suggestion on this mailing list a good while back that there is
a headless X server around that does nothing but look like an Xserver to
X clients, and you could run that on your server, and wxWindows would
think it was talking to a GUI.

[snip]

It's Xvnc, part of the vncserver or tightvnc package depending on your
distro.

There's also Xvfb, which is designed for exactly this. It's in the xvfb
package on debian. I imagine Xvfb is a somewhat lighter solution than
Xvnc.

···

On Wed, Dec 03, 2003 at 01:41:47PM -0800, Robin Dunn wrote:

--
Brian

Brian Victor wrote:

>Chris Barker wrote:
>>recall a suggestion on this mailing list a good while back that there is
>>a headless X server around that does nothing but look like an Xserver to
>>X clients, and you could run that on your server, and wxWindows would
>>think it was talking to a GUI.
[snip]
>It's Xvnc, part of the vncserver or tightvnc package depending on your
>distro.

There's also Xvfb, which is designed for exactly this. It's in the xvfb
package on debian. I imagine Xvfb is a somewhat lighter solution than
Xvnc.

Yup, that's what I was looking for. With a little reading on teh web, It
appears to be a better answer than Xvnc...lighter weight, and less of a
security risk. It also comes with Redhat 7.*, and probably others.

However, a quick try and I could not get it working. Looking a little,
it seems that I need to set up a whole xinit process, which is a
nightmare! Anyway, the man pages are typically terse, and I have no idea
where to go from here. Has anyone gotten this working that could give me
some pointers?

-Chris

···

On Wed, Dec 03, 2003 at 01:41:47PM -0800, Robin Dunn wrote:

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (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

Chris Barker wrote:

OK.

First, I'm really going to need it on Linux if I am going to do anything
with it. I may be abel to work on that, but do you know if there are any
fatal problems, or if it's just that no one has done it.

I also wish that it would work on Linux and if you or anyone else could get it to work there, that would be great! I'll try to explain what I know but I'm just a humble user so I'm not sure if I got all this info straight. Achim, can you comment on this? I would be surprised it there was a fatal problem because GraphicsMagick/ImageMagick is cross-platform.

My (vague) understanding is it had to do with using (the older?) version of Boost.Python which is used to wrap GraphicsMagick. Something about Boost requiring that the code (GraphicsMagick) be inserted in the middle of Boost somewhere and compiled together but the compiling failed. At one point Achim did manage to compile it on Gentoo but we were not able to do the same on Red Hat 8 using his instructions. Even if it did compile, it would have been *non-standard* install and would not have been installable or uninstallable on other people's computers. Achim seems to be primarily a Windows person, so I can't say whether a Linux guru could pull this off, but maybe its possible. I'm certainly not.

Second, do you ahve any idea why Graphics Magick was forked from
ImageMagick? ImageMagick is a wonderful package, what advantages does
GraphicsMAgick have over it?

I don't really know. I remember reading somewhere that Bob Friesenhahn (creator of GraphicsMagick) wanted a more stable, less buggy, library. Actually I would like to know the answer to this my self. Whether politics were involved, I'm not sure. The mission statement is here (http://www.graphicsmagick.org/www/mission.html).

Third, what can it do that PIL can't? I've only used PIL so far.

This is an easy one -- it's 16-bit! I've used PIL for last several years and I've generally been happy with it but recently here at Glenn (microgravity research) more and more people are starting to use 10-bit and 12-bit digital cameras, which usually output the images as a 16-bit or 48-bit TIFF files. PIL can't do 16-bit, so I started looking around for a 16-bit imaging library with Python support and PythonMagick is the only game in town.

Comparing the two libraries, PythonMagick has roughly 95% of the functionality that PIL has but has a few things that PIL is missing. Since I really need a couple of things that PYthonMagick is currently missing, like histogram, I'm using them both for now. Bob F. says that he'll add them to the next version of GraphicsMagick.

In terms of usage, PIL is easier to learn and is more straight forward. Some of this is due to the fact that PIL is hard-coded for 8-bit imaging and so you can make some simplifying assumptions. PythonMagick/GraphicsMagick appears to be more flexible (?). The 16-bit version (known as Q:16) is quite bit slower than PIL or the PythonMagick compiled for 8-bit, but in this age of 3GHz+ machines its not a super big problem.

Hope this helps!
Bob

I am best described as a principal maintainer of GraphicsMagick, since
GraphicsMagick is originally based on ImageMagick 5.5.2, which was
itself originally created by John Cristy in the early '90s. There are
multiple "creators" of GraphicsMagick. Many developers have
contributed to ImageMagick, and many developers continue to contribute
to GraphicsMagick.

GraphicsMagick was created in order to provide a stable form of
ImageMagick, to allow the developers abruptly banished from the
ImageMagick project to continue improving the code-base, and to
provide an open project which accepts additional interested developers
from the community.

Since ImageMagick seems to absorb most enhancements from
GraphicsMagick, the main difference is the open development model, and
the belief that quality and stability and controlled change take
priority over new feature development.

Bob

···

On Thu, 4 Dec 2003, Bob Klimek wrote:

>Second, do you ahve any idea why Graphics Magick was forked from
>ImageMagick? ImageMagick is a wonderful package, what advantages does
>GraphicsMAgick have over it?

I don't really know. I remember reading somewhere that Bob Friesenhahn
(creator of GraphicsMagick) wanted a more stable, less buggy, library.
Actually I would like to know the answer to this my self. Whether
politics were involved, I'm not sure. The mission statement is here
(http://www.graphicsmagick.org/www/mission.html).

======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us
http://www.simplesystems.org/users/bfriesen