python-imager


Namepython-imager JSON
Version 1.2.8 PyPI version JSON
download
home_pageNone
SummaryPython image program
upload_time2024-12-09 16:58:41
maintainerNone
docs_urlNone
authorT-Sana
requires_pythonNone
licenseLICENCE
keywords python image
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pyimager
 Pyimager is a python package for creating, editing and showing images with python.  
 It can be used to create videogames (that's why I use it for) and to many other uses.

 As it is based on opencv-python but not all of these functions are implemented here, you can still use their functions with this library to get the best result of them. But still, open an issue on [GitHub](https://github.com/T-Sana/python-imager/issues) so I can add the functions you need.

# Tutorial
## Creating an image
To create an image you just need to proceed as following:
> `img = image(name="myImage")`

You can modify the parameters of this image specifying it's size, background color and name via the following function:
> `img = new_img(dimensions=[200, 500], background=COL.cyan, name="myImage")`  
Definition for an image of 200x500 pixels with a cyan background color with "myImage" as name.

You can also import a local image:
> `img = image(name="myLocalImage").open_img(path)`
## Showing an image (until gets a keypress)
To show an image just until you get a keypress:
> `img.show_(0)`

To add a timeout, define t as miliseconds before closing
> `img.show_(t)`  
If you want the image to be shown forever: set t to 0.

To get the key that has been pressed:
> `wk = img.show_(t)` wk comes from WaitKey, the cv2 function used by this library.
## Showing an image
To show an image, you should build it first even if you could use `image.show_()` to show the images without 'building' them.  
So, to properly show an image, proceed as following:
> `img = image()`  
> `img.build()`  
> `img.show()`  
You could use `img = image().build()` too if you prefer because `imag.build()` returns an `image`.
## Editing an image
To edit an image, you have to create one first:
> `img = image()` or `img = new_img()`

Then, you can modify your image using the inner functions of the `image` class.  
For drawing a diagonal line accross the image, you can do like this:
> `img.line(p1=[0, 0], p2=img.size(), colour=COL.red, thickness=5, lineType=2)`  
And like this you have a line going from `p1` (0, 0) to `p2` that are the coordinates of the bottom right of the image, the `colour` is red, the `thickness` of the line is 5px and, finally, the `lineType` is setted to 2.

You have 5 inner functions to draw shapes:
> - `image.line(p1, p2, colour, thickness, lineType)`
> - `image.rectangle(p1, p2, colour, thickness, lineType)`
> - `image.circle(ct, radius, colour, thickness, lineType)`
> - `image.ellipse(cr, (radius1, radius2), colour, thickness, lineType, startAngle, endAngle, angle)`
> - `image.polygon(pts:[pt], colour, thickness, lineType)`

And you have 2 inner functions more to write text:
> - `image.write(text, pt, colour, thickness, fontSize, font, lineType)`
> - `image.write_centered(text, ct, colour, thickness, fontSize, font, lineType)`
# Installation
> `pip install python-imager`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-imager",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, image",
    "author": "T-Sana",
    "author_email": "tsana.code@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/79/ca/e14538c3cd0758a2981e0f0e90a2a0baa6fb639f94b11ba84c71d0c3755b/python_imager-1.2.8.tar.gz",
    "platform": null,
    "description": "# Pyimager\n Pyimager is a python package for creating, editing and showing images with python.  \n It can be used to create videogames (that's why I use it for) and to many other uses.\n\n As it is based on opencv-python but not all of these functions are implemented here, you can still use their functions with this library to get the best result of them. But still, open an issue on [GitHub](https://github.com/T-Sana/python-imager/issues) so I can add the functions you need.\n\n# Tutorial\n## Creating an image\nTo create an image you just need to proceed as following:\n> `img = image(name=\"myImage\")`\n\nYou can modify the parameters of this image specifying it's size, background color and name via the following function:\n> `img = new_img(dimensions=[200, 500], background=COL.cyan, name=\"myImage\")`  \nDefinition for an image of 200x500 pixels with a cyan background color with \"myImage\" as name.\n\nYou can also import a local image:\n> `img = image(name=\"myLocalImage\").open_img(path)`\n## Showing an image (until gets a keypress)\nTo show an image just until you get a keypress:\n> `img.show_(0)`\n\nTo add a timeout, define t as miliseconds before closing\n> `img.show_(t)`  \nIf you want the image to be shown forever: set t to 0.\n\nTo get the key that has been pressed:\n> `wk = img.show_(t)` wk comes from WaitKey, the cv2 function used by this library.\n## Showing an image\nTo show an image, you should build it first even if you could use `image.show_()` to show the images without 'building' them.  \nSo, to properly show an image, proceed as following:\n> `img = image()`  \n> `img.build()`  \n> `img.show()`  \nYou could use `img = image().build()` too if you prefer because `imag.build()` returns an `image`.\n## Editing an image\nTo edit an image, you have to create one first:\n> `img = image()` or `img = new_img()`\n\nThen, you can modify your image using the inner functions of the `image` class.  \nFor drawing a diagonal line accross the image, you can do like this:\n> `img.line(p1=[0, 0], p2=img.size(), colour=COL.red, thickness=5, lineType=2)`  \nAnd like this you have a line going from `p1` (0, 0) to `p2` that are the coordinates of the bottom right of the image, the `colour` is red, the `thickness` of the line is 5px and, finally, the `lineType` is setted to 2.\n\nYou have 5 inner functions to draw shapes:\n> - `image.line(p1, p2, colour, thickness, lineType)`\n> - `image.rectangle(p1, p2, colour, thickness, lineType)`\n> - `image.circle(ct, radius, colour, thickness, lineType)`\n> - `image.ellipse(cr, (radius1, radius2), colour, thickness, lineType, startAngle, endAngle, angle)`\n> - `image.polygon(pts:[pt], colour, thickness, lineType)`\n\nAnd you have 2 inner functions more to write text:\n> - `image.write(text, pt, colour, thickness, fontSize, font, lineType)`\n> - `image.write_centered(text, ct, colour, thickness, fontSize, font, lineType)`\n# Installation\n> `pip install python-imager`\n",
    "bugtrack_url": null,
    "license": "LICENCE",
    "summary": "Python image program",
    "version": "1.2.8",
    "project_urls": null,
    "split_keywords": [
        "python",
        " image"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2229bcb722ed1919be50154412731aa04970f2738644a039aa11e5c2f46b1f5e",
                "md5": "8db0cb1866fdc4f06a09fdd734267ee5",
                "sha256": "2a67911032d72ba9dfaf8be1d9f4ecd0449f10071a04426dcebc40306ebd8830"
            },
            "downloads": -1,
            "filename": "python_imager-1.2.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8db0cb1866fdc4f06a09fdd734267ee5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11315,
            "upload_time": "2024-12-09T16:58:40",
            "upload_time_iso_8601": "2024-12-09T16:58:40.301449Z",
            "url": "https://files.pythonhosted.org/packages/22/29/bcb722ed1919be50154412731aa04970f2738644a039aa11e5c2f46b1f5e/python_imager-1.2.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79cae14538c3cd0758a2981e0f0e90a2a0baa6fb639f94b11ba84c71d0c3755b",
                "md5": "7ea5eb3f7f4b15c493ced093264a7ba9",
                "sha256": "0bd9ecf4976f499636744ec7232ba38abbb7c7a7b28baacc71d7bfc76e5586b4"
            },
            "downloads": -1,
            "filename": "python_imager-1.2.8.tar.gz",
            "has_sig": false,
            "md5_digest": "7ea5eb3f7f4b15c493ced093264a7ba9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11654,
            "upload_time": "2024-12-09T16:58:41",
            "upload_time_iso_8601": "2024-12-09T16:58:41.730594Z",
            "url": "https://files.pythonhosted.org/packages/79/ca/e14538c3cd0758a2981e0f0e90a2a0baa6fb639f94b11ba84c71d0c3755b/python_imager-1.2.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-09 16:58:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-imager"
}
        
Elapsed time: 0.38448s