diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..d39e9e6 --- /dev/null +++ b/README.rst @@ -0,0 +1,127 @@ +.. |travis| image:: https://api.travis-ci.org/samirelanduk/imagipy.svg?branch=0.1 + +.. |coveralls| image:: https://coveralls.io/repos/github/samirelanduk/imagipy/badge.svg?branch=0.1 + +.. |pypi| image:: https://img.shields.io/pypi/pyversions/imagipy.svg + + +|travis| |coveralls| |pypi| + +imagipy +======= + +imagipy is an image and color processing library. + +Example +------- + + >>> import imagipy + >>> red = Color(255, 0, 0) + >>> green = Color.from_hex("#00FF00") + >>> blue = Color.from_hex("0000FF") + >>> red.mutate() + + + + + + +Installing +---------- + +pip +~~~ + +imagipy can be installed using pip: + +``$ pip3 install imagipy`` + +imagipy is written for Python 3, and does not support Python 2. It is currently +tested on Python 3.5 and above. + +If you get permission errors, try using ``sudo``: + +``$ sudo pip3 install imagipy`` + + +Development +~~~~~~~~~~~ + +The repository for imagipy, containing the most recent iteration, can be +found `here `_. To clone the +imagipy repository directly from there, use: + +``$ git clone git://github.com/samirelanduk/imagipy.git`` + + +Requirements +~~~~~~~~~~~~ + +imagipy currently has no dependencies. + + +Overview +-------- + +imagipy is an image processing library. It currently has tools for dealing with +colors. + +Colors +~~~~~~ + +Colors are created with the ``Color`` class: + + >>> import imagipy + >>> purple = imagipy.Color(255, 0, 255) + >>> purple + + +You can also create colors from hex strings: + + >>> orange = imagipy.Color.from_hex("#E67E22") + >>> orange + + +imagipy comes with some pre-set colors: + + >>> imagipy.Color.YELLOW + + >>> imagipy.Color.GRAY + + >>> imagipy.Color.BROWN + + +You can get a random color, or mutate an existing color to get a slight variant +on it: + + >>> imagipy.Color.random() + + >>> imagipy.Color.random() + + >>> imagipy.Color.random() + + >>> orange.mutate() + + >>> orange.mutate() + + >>> orange.mutate() + + +Colors can be converted to RGB or hex: + + >>> orange.rgb() + (230, 126, 34) + >>> orange.hex() + '#E67E22' + + +Changelog +--------- + +Release 0.1.0 +~~~~~~~~~~~~~ + +`29 October 2017` + +* Added basic Color class. +* Added Color generation from RGB, hex, random, and mutation. diff --git a/imagipy/colors.py b/imagipy/colors.py index f2eea4b..c588a7e 100644 --- a/imagipy/colors.py +++ b/imagipy/colors.py @@ -23,7 +23,7 @@ def __init__(self, r, g, b): @staticmethod def from_hex(hexcolor): """An alternate constructor which creates a color from a hex string - such as ``'#0B9586'``. The preceding `#` is optional. + such as ``'#0B9586'``. The preceding ``#`` is optional. :param str hexcolor: The hex string representing the desired color. :raises TypeError: if a non-string is given. @@ -77,7 +77,7 @@ def mutate(self): direction. :rtype: ``Color``""" - + r = randint(self._r - 16, self._r + 16) g = randint(self._g - 16, self._g + 16) b = randint(self._b - 16, self._b + 16) diff --git a/setup.py b/setup.py index 80610bb..e1ba6c8 100644 --- a/setup.py +++ b/setup.py @@ -15,5 +15,5 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6"], - packages=["imagipy", "imagipy.models"], + packages=["imagipy"], install_requires=[])