473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GD/gdmodule on Win XP

Hi All,

I'm trying to setup matplotlib (http://matplotlib.sourceforge.net/) in
a Win XP box.

I have two questions:

1. How do I install the GD Lib (http://www.boutell.com/gd)? The zip
contains a compiled dll. Is it enough to put it in /Windows/System32?

2. The python interface to GD at
http://newcenturycomputers.net/projects/gdmodule.html (gdmodule) has a
setup.py script for Linux systems. Is there any windows/multiplatfor
version? I tried to hack it including the /Windows/systm32 dir in the
libdirs variables and renaming the dll file to gd.dll, but the script
doesn't work either.

Thank you in advance.

Ed.
Jul 18 '05 #1
5 3722
>>>>> "Eduardo" == Eduardo Elgueta <ee******@navix.cl> writes:

Eduardo> Hi All, I'm trying to setup matplotlib
Eduardo> (http://matplotlib.sourceforge.net/) in a Win XP box.

gdmodule is difficult to install on windows (as you've discovered).
Fortunately, Stefan Kuzminski figured this out and built a statically
linked gd module - no need to download gd lib or freetype, etc. Here
are the compile notes he posted to the matplotlib-users mailing list

http://sourceforge.net/mailarchive/m...msg_id=7064914

and here is a link to the dll; just put this in your site-packages dir.

http://matplotlib.sourceforge.net/gd/_gd.dll

You will also need to place gd.py from the gdmodule-0.51 distro in
site-packages. After that you should be able to do
python
import gd


IMPORTANT - I've been doing a lot of development on the gd backend of
late and the latest version of matplotlib requires a patched version
of gdmodule (which will become included in the standard gdmodule at
the next release). So the DLL linked above *will not* work with
matplotlib-0.50. Thus you will need to either:

* downgrade to matplotlib-0.42.2 -
http://sourceforge.net/project/showf...group_id=80706

* build the patched gdmodule using
http://matplotlib.sourceforge.net/gd/_gdmodule.c. If you do
this, you can take advantage of the improvements made in the gd
backend subsequent to 0.42.2. Please mail me a copy of the DLL
if you succeed with any compile notes.

Of course you still need to the prerequisites described on
http://matplotlib.sourceforge.net/backends.html#GD, but gdmodule is
definitely the tough nut to crack on win32.

I haven't built fonttools for win32 in some time, so if someone else
can pipe in and share their insights I'd be happy. I found the TTX
installer on the sourceforge site, but this doesn't seem to provide
the python fontools package.

With the prereqs installed, you can test your setup with

import matplotlib
matplotlib.use('GD')
from matplotlib.matlab import *
plot([1,2,3])
savefig('gdtest')

Good luck!
John Hunter

Jul 18 '05 #2
John,

Thank you very much for such a complete answer.

I'll try it and let you now if I succeed building the patched gdmodule.

Best regards,

Ed.

<cita quien="John Hunter">
>> "Eduardo" == Eduardo Elgueta <ee******@navix.cl> writes:


Eduardo> Hi All, I'm trying to setup matplotlib
Eduardo> (http://matplotlib.sourceforge.net/) in a Win XP box.

gdmodule is difficult to install on windows (as you've discovered).
Fortunately, Stefan Kuzminski figured this out and built a statically
linked gd module - no need to download gd lib or freetype, etc. Here
are the compile notes he posted to the matplotlib-users mailing list

http://sourceforge.net/mailarchive/m...msg_id=7064914

and here is a link to the dll; just put this in your site-packages dir..

http://matplotlib.sourceforge.net/gd/_gd.dll

You will also need to place gd.py from the gdmodule-0.51 distro in
site-packages. After that you should be able to do
> python
>>> import gd


IMPORTANT - I've been doing a lot of development on the gd backend of
late and the latest version of matplotlib requires a patched version
of gdmodule (which will become included in the standard gdmodule at
the next release). So the DLL linked above *will not* work with
matplotlib-0.50. Thus you will need to either:

* downgrade to matplotlib-0.42.2 -
http://sourceforge.net/project/showf...group_id=80706

* build the patched gdmodule using
http://matplotlib.sourceforge.net/gd/_gdmodule.c. If you do
this, you can take advantage of the improvements made in the gd
backend subsequent to 0.42.2. Please mail me a copy of the DLL
if you succeed with any compile notes.

Of course you still need to the prerequisites described on
http://matplotlib.sourceforge.net/backends.html#GD, but gdmodule is
definitely the tough nut to crack on win32.

I haven't built fonttools for win32 in some time, so if someone else
can pipe in and share their insights I'd be happy. I found the TTX
installer on the sourceforge site, but this doesn't seem to provide
the python fontools package.

With the prereqs installed, you can test your setup with

import matplotlib
matplotlib.use('GD')
from matplotlib.matlab import *
plot([1,2,3])
savefig('gdtest')

Good luck!
John Hunter

--
Eduardo Elgueta
Senior Consultant
Navix

correo/email: ee******@navix.cl
teléfono/phone: +56 (2) 209-8905
celular/mobile: +56 (9) 821-0033
web: www.navix.cl

Av. Pedro de Valdivia 555 Of. 216
Providencia 750-0913
Santiago, Chile

Jul 18 '05 #3
>>>>> "Eduardo" == Eduardo Elgueta <ee******@navix.cl> writes:

Eduardo> John, Thank you very much for such a complete answer.

Eduardo> I'll try it and let you now if I succeed building the
Eduardo> patched gdmodule.

That would be great. In the mean time, I have two more pieces of
advice

There is a strange bug that Stefan discovered when saving some images
on win32. You need to change the line in
matplotlib.backends.backend_gd.print_figure from

im.writePng( file(filename, 'wb') )
to
im.writePng( filename )

Also, if you need windows installers for fonttools, I built them last
night for python2.2 and python2.3. Let me know and I'll send you one.

I'd like to add a section 'building GD on win32' to the website, so
let me know if you have anything to add to that.

JDH
Jul 18 '05 #4
I just went through a similar process in getting a native 2.3 version
of the jpgraph charting library to build on windows. While not
exactly, the same, I hope these notes will help you out.

Things build fairly straightforward using MINGW and MINSYS to build
the python extentions. The process is went like this:

Install MINGW and MINSYS

Run dll tool on Python23 to make libpython23.a:
[from: http://sebsauvage.net/python/mingw.html)
pexports python23.dll > python23.def
(get it from http://starship.python.net/crew/kern...orts-0.42h.zip)
dlltool --dllname python23.dll --def python23.def --output-lib
libpython23.a
Copy libpython23.a to c:\python23\libs\
]
Then for each module, one at a time, perform the following sequence:

Untar the source archive.
Open a minsys window and do a compile. Config generally works when
they have them. Other changes are to add the python include dir to
CFLAGS and to add python23 to the linker libs and the python 'libs'
dir to the LD library path.
Copy all the resulting "lib*.a" files to C:\mingw\lib (adjusting for
your installation of course!).
Inspect the makefile install target to determine what ".h" files
should be copied. Copy these over to c:\mingw\include.
For python modules, copy the .pyd files to your python home
\lib\site-packages directory.

After some trial and error, I found I had to build the modules in the
following order:

freetype-2.1.5
zlib-1.2.1
libpng-1.2.5
jpeg-6b
gd-1.8.4
gdmodule-0.26
jpgraph-1.5.3

I'm sure there's room for improvement, for example make install might
have worked. I didn't really care about the amount of manual copying
in this process as I just wanted the resulting python library.
Jul 18 '05 #5
John,

Ok. See you around.

Ed.

<cita quien="John Hunter">
>> "Eduardo" == Eduardo Elgueta <ee******@navix.cl> writes:


Eduardo> John, Thank you very much for such a complete answer.

Eduardo> I'll try it and let you now if I succeed building the
Eduardo> patched gdmodule.

That would be great. In the mean time, I have two more pieces of
advice

There is a strange bug that Stefan discovered when saving some images
on win32. You need to change the line in
matplotlib.backends.backend_gd.print_figure from

im.writePng( file(filename, 'wb') )
to
im.writePng( filename )

Also, if you need windows installers for fonttools, I built them last
night for python2.2 and python2.3. Let me know and I'll send you one.

I'd like to add a section 'building GD on win32' to the website, so
let me know if you have anything to add to that.

JDH

--
Eduardo Elgueta
Senior Consultant
Navix

correo/email: ee******@navix.cl
teléfono/phone: +56 (2) 209-8905
celular/mobile: +56 (9) 821-0033
web: www.navix.cl

Av. Pedro de Valdivia 555 Of. 216
Providencia 750-0913
Santiago, Chile

Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Gonnerman | last post by:
A user contacted me a week or so ago about problems building the new gdmodule version. A moment's study revealed the problem... the GD include file gd_io.h contains a structure which has changed...
6
by: vald | last post by:
I wonder if there is any module for rendering True Type Fonts in Python ? I need to create a GIF files with nice antialiased text and I'm unable to find any module with such functionality. ...
1
by: John Hunter | last post by:
Does gd lib or gdmodule support clipping? I would like to set a clip rectangle and when I issue drawing commands (like im.polygon) have only the part of the polygon inside the clip rectangle...
0
by: John Hunter | last post by:
When using gdmodule to draw text using true type fonts im.string_ttf(font, fontsize, angle, (x,y), s, color) the docs say 'draw string s at (x,y) using the TrueType font at the given pointsize...
0
by: John Hunter | last post by:
GD module has a constant gdMaxColors >From the web page: Maximum number of colors in an image; GD will likely change this figure in a future version. Is there any way to increase this...
14
by: John Hunter | last post by:
I have a list of two tuples containing x and y coord (x0, y0) (x1, y1) ... (xn, yn) Given a new point x,y, I would like to find the point in the list closest to x,y. I have to do this a...
13
by: Tim Henderson | last post by:
Hi I want to dynamically generate a graph in python that would be displayable on a web page. What would be the best way to do this? The reason I want to do this, is because I am making a program...
4
by: Steven Feil | last post by:
I am wondering if there is a light weight Python library for producing web graphics on-the-fly. There is a C-language library called gd that can be used in a CGI program to produce gif images. The...
5
by: jeff | last post by:
could somebody explain to me how to install (or compile) GD for linux, so that it works in pyhton?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.