|
From: John H. <jdh...@ac...> - 2004-01-26 06:30:00
|
>>>>> "Kuzminski," == Kuzminski, Stefan R <SKu...@fa...> writes:
Kuzminski> I attached a '_gd.dll'. This is the C python
Kuzminski> extension that the gd.py module from gdmodule imports.
Kuzminski> It goes directly in site-packages. I built it
Kuzminski> statically linked to zlib, libpng, freetype and the gd
Kuzminski> lib. I don't have the time at the moment to fuss with
Kuzminski> getting it to use the dlls. ( or to add the jpeg
Kuzminski> support ) The precompiled windows GD dll in particular
Kuzminski> seems to not export a few functions that gdmodule
Kuzminski> wants which is a real pain.
Excellent, the easier the better...
Kuzminski> 2) This one took me a long time to figure out. For
Kuzminski> some reason opening a windows file in Python with 'wb'
Kuzminski> permission will cause the png files to be corrupted
Kuzminski> above a certain image size. If you pass the filename
Kuzminski> to gdmodule, then the gdmodule opens the file and it
Kuzminski> works. I imagine that the python call "open(
Kuzminski> 'filename', 'wb' )" just calls fopen, furthermore I
Kuzminski> thought that binary mode only applied to reading
Kuzminski> files. At any rate, I have no idea why this doesn't
Kuzminski> work in this case but it doesn't. To get it to work,
Kuzminski> I had to change line 261 in backends_gd.py to pass the
Kuzminski> filename rather than a file object, this is the only
Kuzminski> modification to Matplotlib I had to make.
Could be that I don't have the text bounding boxes exactly right in
gdmodule. In axes.py there is a line on or around line 454
if 0:
if you replace that with
if 1:
the text bounding boxes will be displayed. If they are not exactly
right, then the text layout will also be off. I'll take a look when I
get some time, but in the mean time you may want to see for yourself.
Re: gdmodule on windows. What did you do for fonttools? Did you also
build this yourself? If I recall correctly I built it once on windows
without too much difficulty (back when I was trying to get gd working
on windows) but it's been a while and I didn't keep notes. I didn't
see an installer on the sf site.
JDH
Kuzminski> im.writePng( filename )
Kuzminski> #2 above is the answer to the problem in my original
Kuzminski> post. However I have another question. When I set the
Kuzminski> ylabel rotation to be horizontal, the beginning of the
Kuzminski> text is truncated ( the width of the border does not
Kuzminski> compensate ). I'm happy to set it wider but am
Kuzminski> wondering how ( what controls the width of the area
Kuzminski> where the labels gets written ). I also noticed that
Kuzminski> title of the graph ( with the horizontal alignment set
Kuzminski> to bottom ) is too close to the top of the graph
Kuzminski> itself, is there a way to pad that?
Kuzminski> thanks, Stefan
Kuzminski> -----Original Message----- From: John Hunter
Kuzminski> [mailto:jdh...@ni...] Sent:
Kuzminski> Friday, January 23, 2004 6:58 AM To: Kuzminski, Stefan
Kuzminski> R Cc: mat...@li... Subject:
Kuzminski> Re: [Matplotlib-users] broken PNG files with GD
Kuzminski> backend
>>>>> "Kuzminski," == Kuzminski, Stefan R <SKu...@fa...>
Kuzminski> writes:
Kuzminski> Now on to my specific problem. I'm using the GD
Kuzminski> backend on Windows with Matplotlib 0.41.
Kuzminski> First things first -- I haven't succeeded in getting
Kuzminski> the gd backend compiled on windows. If you have some
Kuzminski> expertise here and are willing to share, or better yet
Kuzminski> build a gdmodule and gd installer that I can put on
Kuzminski> the website, I would be very much obliged! I
Kuzminski> contacted the gdmodule maintainer some time ago over
Kuzminski> this issue and he had never built it on windows
Kuzminski> either. In my googling, I discovered the perl gd
Kuzminski> module for windows and following their lead, succeeded
Kuzminski> in building gd lib, but ran into some troubles (can't
Kuzminski> remember what) building gdmodule.
Kuzminski> If I set the dpi to over 60 the png file that gets
Kuzminski> generated is 'empty', it's only 17 bytes long. As soon
Kuzminski> as I drop he DPI to below 65 or so, I get the image
Kuzminski> file correctly. This is with the simple_plot.py
Kuzminski> example.
Kuzminski> Now on to your problem. Is there a typo here? You say
Kuzminski> over 60 is empty and under 65 is ok ?? Can you send
Kuzminski> me a script which replicates the problem, with the two
Kuzminski> calls to savefig, one which has the problem and which
Kuzminski> does not. Then I can begin to diagnose the problem;
Kuzminski> see if it occurs under linux, see if it's a gd
Kuzminski> problem, see if it's a problem on my end, etc....
Kuzminski> Are you using matplotlib + GD for a web app server?
Kuzminski> John Hunter
|