Skip to content

Commit 5fa93fd

Browse files
updated readme
1 parent 4a1245a commit 5fa93fd

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# py_gd
1+
# `py_gd`
22

33
Python wrappers for libgd graphics drawing lib.
44

5-
Welcome to the py_gd project.
5+
Welcome to the `py_gd` project.
66

7-
py-gd aims to provide nice pythonic wrappers around libgd -- a nice, fast, and simple drawing lib:
7+
py-gd aims to provide nice Pythonic wrappers around libgd -- a nice, fast, and simple drawing lib:
88

99
https://github.com/libgd/libgd/
1010

@@ -14,52 +14,51 @@ For the project at hand we needed fast and simple drawing -- 8-bit color, no ant
1414
We also wanted a nice simple API to work with. There are a number of newer drawing libs (AGG, Skia)
1515
that produce some pretty results, but are not as simple to use, and are focused on 32 bit fully
1616
anti-aliased drawing. If you want the prettiest rendering possible, I encourage you to check those out.
17-
If you want something fast and simple -- py_gd may be for you.
17+
If you want something fast and simple -- `py_gd` may be for you.
1818

1919
## Why a new python wrapper for gd?
2020

21-
gdmodule (recently moved to gitHub: https://github.com/Solomoriah/gdmodule) is a wrapper
22-
for gd that has been aaround along time. However:
21+
`gdmodule` (recently moved to gitHub: https://github.com/Solomoriah/gdmodule) is a wrapper
22+
for gd that has been around along time. However:
2323
- It appears to be minimally maintained
2424
- It is a pretty direct wrapper around the gd old-style-C API
2525
- It is hand-written C extension code -- more or less the state of the art for 1995
2626
when it was first written, but I really don't want to work on that code!
2727

2828
On the other hand:
29-
- py_gd is being actively worked on now. While only supporting Py2 at the moment,
30-
it should be pretty easy to make a Py3k version.
31-
- py_gd is a "thick" wrapper -- we're trying to provide a nice object oriented, pythonic inteface.
32-
- py_gd uses numpy (and the PEP3118 buffer interface) to allow efficient transfer of data back and forth between Python and gd.
33-
- py_gd is written in cython, which is likely to be more robust and error free and easier to maintain.
29+
- `py_gd` is being actively maintained.
30+
- `py_gd` is a "thick" wrapper -- we're trying to provide a nice object oriented, Pythonic interface.
31+
- `py_gd` uses numpy (and the PEP3118 buffer interface) to allow efficient transfer of data back and forth between Python and gd.
32+
- `py_gd` is written in Cython, which is likely to be more robust and error free and easier to maintain.
3433

35-
However, there is some nice stuff in gdmodule (like including a truetype font) that I we want to borrow.
34+
However, there is some nice stuff in gdmodule (like including a truetype font) that we want to borrow at some point.
3635

37-
## How is py_gd built?
36+
## How is `py_gd` built?
3837

39-
py_gd is built using Cython: (www.cython.org). Cython allows us to both call into the existing gd C lib, and to also write wrapper code to make a nicer API in a very efficient way. You shouldn't need Cython to use py_gd, but you'll need it if you want to contribute to the wrappers.
38+
`py_gd` is built using Cython: (www.cython.org). Cython allows us to both call into the existing gd C lib, and to also write wrapper code to make a nicer API in a very efficient way. You shouldn't need Cython to use `py_gd`, but you'll need it if you want to contribute to the wrappers or compile the code yourself.
4039

4140

4241
## Dependencies:
4342

44-
py_gd currently requires the numpy package: http://www.numpy.org
43+
`py_gd` currently requires the numpy package: http://www.numpy.org
4544

46-
numpy is used to allow you to very efficiently pass in data structures for things like vertexes 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.
45+
numpy is used to allow you to very 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`.
4746

48-
In order to build py_gd, the Cython package is also required: http://cython.org/
47+
In order to build `py_gd`, the Cython package is also: http://cython.org/
4948

50-
## Is py_gd a complete wrapper around gd?
49+
## Is `py_gd` a complete wrapper around gd?
5150

5251
In a word: no.
5352

54-
py_gd is in its infancy, and not the least bit complete. It does, however have enough to be useful (at least to us).
53+
`py_gd` was developed to meet particular needs, and is not the least bit complete. It does, however have enough to be useful (at least to us).
5554

5655
Major Working features:
5756
* 8-bit "paletted" images
5857
* transparent background
5958
* built-in fonts for text
6059
* lines, polygons, arcs
6160
* copying between images
62-
* saving as gif, bmp, png, jpeg
61+
* saving as gif, bmp, png, jpeg, and animated gif.
6362
* numpy arrays for input and image buffer exchange.
6463

6564
Major Missing features:
@@ -75,46 +74,47 @@ You sure you can -- fork the source, and hack away -- you can actually add featu
7574
Here's what you need to do:
7675

7776
* find the function you want to wrap in gd.h
78-
* copy the prototype to py_gd.pxd, and edit it to make it Cython-compatible (copy what's done for the ones already there)
79-
* add a method to the Image class in py_gd.pyx -- look for similar methods already, and try to keep the API similar.
80-
* add a test to test_gd.py (Or a new test file) that tests your new method
81-
* re-build (``pip install -e ./`` or ``setup.py build_ext --inplace``)
77+
* copy the prototype to `py_gd.pxd`, and edit it to make it
78+
Cython-compatible (copy what's done for the ones already there)
79+
* add a method to the Image class in `py_gd.pyx` -- look for similar
80+
methods already, and try to keep the API similar.
81+
* add a test to `test_gd.py` (Or a new test file) that tests your new
82+
method
83+
* re-build (``pip install -e ./`` or
84+
``setup.py build_ext --inplace``)
8285
* try out your test...
8386
* lather, rinse, repeat, 'till it all works
8487

8588
# Build/Install
8689

8790
## Windows
8891

89-
py_gd depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build on Windows. Unless you are an expert, we suggest using Anaconda Python [https://www.continuum.io/why-anaconda], and the conda packages found in the noaa-orr-erd Anaconda channel. It should be as easy as:
92+
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build on Windows. Unless you are an expert, we suggest using Anaconda Python [https://www.continuum.io/why-anaconda], or miniconda and the conda packages found in the conda-forge channel. It should be as easy as:
9093

9194
```
92-
conda install -c https://conda.anaconda.org/noaa-orr-erd py_gd
95+
conda install -c https://conda.anaconda.org/conda-forge py_gd
9396
```
9497

9598
## OS-X
9699

97-
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, but it's probably easier to use Anaconda Python [https://www.continuum.io/why-anaconda], and the conda packages found in the noaa-orr-erd Anaconda channel. It should then be as easy as:
100+
`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, but it's probably easier to use Anaconda Python [https://www.continuum.io/why-anaconda], or miniconda and the conda packages found in the conda-forge channel. It should be as easy as:
98101

99102
```
100-
conda install -c https://conda.anaconda.org/noaa-orr-erd py_gd
103+
conda install -c https://conda.anaconda.org/conda-forge py_gd
101104
```
102105

103-
## Linux
104-
105-
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
106106

107-
### Anaconda
107+
## Linux
108108

109-
We've put up pacakges for the Anaconda python distribution [https://www.continuum.io/why-anaconda] in our channel. So if yo'pve got Anaconda (or miniconda) installed, it should be as easy as:
109+
`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. However, uyou can also use conda pacakges on Linux. Install Anaconda Python [https://www.continuum.io/why-anaconda], or miniconda and use the conda packages found in the conda-forge channel. It should be as easy as:
110110

111111
```
112-
conda install -c https://conda.anaconda.org/noaa-orr-erd py_gd
112+
conda install -c https://conda.anaconda.org/conda-forge py_gd
113113
```
114114

115115
### building libgd
116116

117-
py_gd requires libgd version 2.1.1 (or maybe greater?). 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:
117+
`py_gd` requires libgd version 2.1.1 (or maybe greater?). 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:
118118

119119
```bash
120120
apt-get install libgd, libgd-dev
@@ -139,16 +139,16 @@ dance. This will install into ``/usr/local/`` if you use the defaults. If your s
139139
```bash
140140
export LD_LIBRARY_PATH='/usr/local/lib'
141141
```
142-
(or set that globally) It needs to be set whenever you are running py_gd.
142+
(or set that globally) It needs to be set whenever you are running `py_gd`.
143143

144144
Note: If you determine that you lack jpeg support these libs are known to be compatible and can be installed through yum:
145145

146146
* libjpeg-turbo-devel
147147
* libjpeg-turbo
148148

149-
## Building py_gd
149+
## Building `py_gd`
150150

151-
* Clone the [py_gd repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
151+
* Clone the [`py_gd` repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
152152
* Create a virtualenv or conda environemnt to scope your python installations to this project (<i>optional</i>)
153153
* pip install cython
154154
* pip install numpy
@@ -157,7 +157,7 @@ Note: If you determine that you lack jpeg support these libs are known to be com
157157

158158
```bash
159159
$ python setup.py build
160-
$ pip install -e ./
160+
$ pip install ./
161161
```
162162

163163
* pip install pytest and run py.test to see that everything is working:

py_gd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
import os
1515

16-
__version__ = "2.0.1"
16+
__version__ = "2.0.2"
1717

1818
if sys.platform.startswith('win'):
1919
# This only works for Anaconda / miniconda

0 commit comments

Comments
 (0)