broken PNG files with GD backend

The windows GD build is bear. I had it completely working, then I
upgraded to 0.41 and took a few steps back.

First a little background. I'm building a reporting tool for a
commercial analytics platform. This tool takes an XML specification and
data, and outputs HTML tables and plots. The larger platform is all
Java, I am providing the reporting as an stand alone ( Python )
executable on Win32, Linux and Solaris. So my overall requirements are
to create HTML ( and hence .png images ) on all three platforms with a
distribution of a single binary file ( one for each platform ).

Here are some quick notes on what I have had to do, once it is working,
I will provide at least the MSVC makefiles an maybe a binary build, time
permitting.

the GD backend has these dependencies..

libpng
zlib
gd
freetype
gdmodule

The 2 main problems I seem to have are that the dll release of GD does
not include a gd.lib. ( MSVC needs a .lib to link with a .dll ) GD does
not seem to come with a windows make file, so I made one.

The other problem is that _gdmodule.c needs to have line 1882 changed to
pass a NULL to PYObject_HEAD_INIT

...
static PyTypeObject Imagetype = {
    PyObject_HEAD_INIT(NULL)
...

I am working on this currently and will post more results as I get them.

thanks,
Stefan

···

-----Original Message-----
From: John Hunter [mailto:jdhunter@…8…]
Sent: Friday, January 23, 2004 6:58 AM
To: Kuzminski, Stefan R
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] broken PNG files with GD backend

"Kuzminski," == Kuzminski, Stefan R <SKuzminski@...79...>

writes:

    > Now on to my specific problem. I'm using the GD
    > backend on Windows with Matplotlib 0.41.

First things first -- I haven't succeeded in getting the gd backend
compiled on windows. If you have some expertise here and are willing
to share, or better yet build a gdmodule and gd installer that I can
put on the website, I would be very much obliged! I contacted the
gdmodule maintainer some time ago over this issue and he had never
built it on windows either. In my googling, I discovered the perl gd
module for windows and following their lead, succeeded in building gd
lib, but ran into some troubles (can't remember what) building
gdmodule.

    > If I set the dpi to over 60 the png file that gets
    > generated is 'empty', it's only 17 bytes long. As soon
    > as I drop he DPI to below 65 or so, I get the image
    > file correctly. This is with the simple_plot.py
    > example.

Now on to your problem. Is there a typo here? You say over 60 is
empty and under 65 is ok ?? Can you send me a script which replicates
the problem, with the two calls to savefig, one which has the problem
and which does not. Then I can begin to diagnose the problem; see if
it occurs under linux, see if it's a gd problem, see if it's a problem
on my end, etc....

Are you using matplotlib + GD for a web app server?

John Hunter