You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
py-gd aims to provide nice Pythonic wrappers around libgd -- a robust, fast, and simple drawing lib:
7
+
py_gd aims to provide nice Pythonic wrappers around libgd -- a robust, fast, and simple drawing lib:
8
8
9
9
Docs here:
10
10
@@ -27,7 +27,7 @@ If you want something fast and simple -- `py_gd` may be for you.
27
27
28
28
`gdmodule` (gitHub: https://github.com/Solomoriah/gdmodule) is a wrapper
29
29
for gd that has been around along time. However:
30
-
- It appears to be minimally maintained (last touched 9 years ago as of this writing)
30
+
- It appears to be unmaintained (last touched 12 years ago as of this writing)
31
31
- It is a pretty direct wrapper around the gd old-style-C API
32
32
- It is hand-written C extension code -- more or less the state of the art for 1995
33
33
when it was first written, but I really don't want to work on that code!
@@ -47,15 +47,19 @@ However, there is some nice stuff in gdmodule (like including a truetype font) t
47
47
48
48
## Dependencies:
49
49
50
-
`py_gd` currently requires the numpy package: http://www.numpy.org
50
+
### Run Time
51
+
52
+
At run time, `py_gd` currently requires the numpy package: http://www.numpy.org, but nothing else.
51
53
52
54
numpy is used to allow you to efficiently pass in data structures for things like vertices of large polygons, etc, and can be used to get a copy of the image buffer, and manipulate it in various ways, as well as passing it back to `py_gd`.
53
55
56
+
### Build Time
57
+
54
58
In order to build `py_gd`, the Cython package is also required: http://cython.org/
55
59
56
60
Most critically, `py_gd` requires the `libgd` libary, which itself requires a number of other libs, such as `libpng`, `libjpeg`, etc, etc...
57
61
58
-
This makes it a challenge to build on any platform other than Linux. Which is why we use the conda-forge system -- it provides `lib_gd`for us.
62
+
See the Install section for more info
59
63
60
64
## Is `py_gd` a complete wrapper around gd?
61
65
@@ -68,14 +72,14 @@ Major Working features:
68
72
* transparent background
69
73
* built-in fonts for text
70
74
* lines, polygons, arcs
71
-
*experimental spline support (not in libgd itself)
75
+
*cubic spline support (not in libgd itself)
72
76
* copying between images
73
77
* saving as gif, bmp, png, jpeg, and animated gif.
74
78
* numpy arrays for input and image buffer exchange.
75
79
76
80
Major Missing features:
77
81
* 32bit "truecolor" support
78
-
* loading images from gif, png, etc...
82
+
* loading images from gif, png, etc... (not hard to add, just haven't needed it)
79
83
* freetype fonts
80
84
* image manipulations: scaling, etc
81
85
@@ -98,7 +102,7 @@ Here's what you need to do:
98
102
99
103
# Install
100
104
101
-
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build yourself. we suggest using conda via miniconda, miniforge, or pixi, and the conda packages found in the conda-forge channel. It should be as easy as:
105
+
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build yourself. We suggest using conda via miniconda, miniforge, or pixi, and the conda packages found in the conda-forge channel. It should be as easy as:
@@ -108,27 +112,43 @@ This currently works on Mac, Windows and Linux
108
112
109
113
## pip installing
110
114
111
-
We try to maintain packages on PyPi, but they are only source packages -- they will need to be built to work. This is fairly straightforward on Linux, but a serious challenge on Windows and Mac. NOTE: contributions of wheels would be happily accepted.
115
+
We try to maintain packages on PyPi, but they are only source packages -- they will need to be built to work. This is fairly straightforward on Linux, but a serious challenge on Windows and Mac.
116
+
117
+
NOTE: we are working on pre-built wheels for all major platforms -- stay tuned!
118
+
119
+
Contributions to the effort would be happily accepted: see:
120
+
121
+
https://github.com/NOAA-ORR-ERD/py_gd/issues/34
122
+
123
+
For progress.
112
124
113
125
# Building
114
126
115
127
## Windows
116
128
117
129
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build on Windows.
118
130
119
-
Folks have had some luck getting it going with the newer Windows clib providers.
131
+
So far, folks have had the most luck with using the vcpkg system.
132
+
133
+
https://vcpkg.io/en/index.html
134
+
135
+
`libgd` is on there, and theoretically can simply be installed::
136
+
137
+
vcpkg install libgd
138
+
139
+
Once vcpkg is setup up properly -- I am no expert on this -- let us know if it works for you, and if you needed to do anything special.
120
140
121
141
122
142
## OS-X
123
143
124
-
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- You can use macports or homebrew or roll your own to get these, and then the build should work.
144
+
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- You can use macports or homebrew or vcpkg to roll your own to get these, and then the build should work.
125
145
146
+
We have not tested this ourselves -- let us know what works for you.
126
147
127
148
## Linux
128
149
129
-
`py_gd` depends on libgd, which may be available in your distro's repo (it's used heavily by PHP). However your distro's version may be too old for `py_gd`, so you may have to built it yourself.
150
+
`py_gd` depends on libgd, which may be available in your distro's repo (it's used heavily by PHP).
130
151
131
-
### building libgd
132
152
133
153
`py_gd` requires libgd version >= 2.3. If your Linux distro has an up to date version, you can probably simply install it (and the development headers) from the system repos. something like:
or similar yum command (maybe just ``gd`` rather than ``libgd``
139
159
140
-
### If you dont have a recent libgd
160
+
Once the library and headers are installed to "normal" locations,
161
+
the py_gd build system should find them
141
162
142
-
If your distro doesn't have a recent version, you'll need to download the source and build it yourself.
143
163
144
-
(not tested recently)
145
164
146
-
* Download the source code from [GitHub](https://github.com/libgd/libgd/releases/)
147
-
* Build the tar file from source and install it. The usual:
165
+
## Building `py_gd`
148
166
149
-
```bash
150
-
$ ./configure
151
-
$ make
152
-
$ make install
153
-
```
167
+
### get the source:
154
168
155
-
dance. This will install into ``/usr/local/`` if you use the defaults. If your system is not yet set up to find libraries in ``/usr/local/``, then you need to add this line to your bashrc:
169
+
You can get the source:
156
170
157
-
```bash
158
-
export LD_LIBRARY_PATH='/usr/local/lib'
159
-
```
160
-
(or set that globally) It needs to be set whenever you are running `py_gd`.
171
+
* From PyPI:
161
172
162
-
Note: If you determine that you lack jpeg support -- yu should be able to install jpeg libs with your distro package mamager, e.g.
173
+
* From a [release on GitHub:](https://github.com/NOAA-ORR-ERD/py_gd/releases)
163
174
164
-
* libjpeg-turbo-devel
165
-
* libjpeg-turbo
175
+
* By cloning the [`py_gd` repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
166
176
167
-
## Building `py_gd`
168
177
169
-
* Clone the [`py_gd` repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
170
-
* Create a virtualenv or conda environment to scope your python installations to this project (<i>optional</i>)
178
+
It's a good idea to create a venv, virtualenv or conda environment to scope your python installations to this project.
0 commit comments