cjm-pil-utils


Namecjm-pil-utils JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/cj-mills/cjm-pil-utils
SummarySome PIL utility functions I frequently use.
upload_time2024-02-06 19:29:59
maintainer
docs_urlNone
authorcj-mills
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cjm-pil-utils

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Install

``` sh
pip install cjm_pil_utils
```

## How to use

### get_img_files

``` python
from cjm_pil_utils.core import get_img_files
from pathlib import Path
```

``` python
img_dir = Path('../images/')
img_paths = get_img_files(img_dir)
img_paths
```

    [PosixPath('../images/cat.jpg'), PosixPath('../images/depth-cat.png')]

### resize_img

``` python
from cjm_pil_utils.core import resize_img
from PIL import Image  # For working with images
```

``` python
img_path = img_paths[0]
src_img = Image.open(img_path).convert('RGB')
print(f"Image Size: {src_img.size}")

resized_img = resize_img(src_img, target_sz=384, divisor=32)
print(f"New Image Size: {resized_img.size}")
```

    Image Size: (768, 512)
    New Image Size: (576, 384)

### stack_imgs

``` python
from cjm_pil_utils.core import stack_imgs
```

``` python
stacked_imgs = stack_imgs([resized_img, resized_img])
print(f"Stacked Image Size: {stacked_imgs.size}")
```

    Stacked Image Size: (576, 768)

### avg_images

``` python
from cjm_pil_utils.core import avg_images
```

``` python
img_1, img_2 = (Image.open(path) for path in img_paths)
avg_img = avg_images(img_1, img_2, 0.5)
```

### crop_square

``` python
from cjm_pil_utils.core import crop_square
```

``` python
crop_square(src_img).size
```

    (512, 512)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cj-mills/cjm-pil-utils",
    "name": "cjm-pil-utils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nbdev jupyter notebook python",
    "author": "cj-mills",
    "author_email": "millscj.mills2@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/19/65c8d86545b5c9ad066c0be5c095e6af8956689015bf0e7540ffd9214001/cjm-pil-utils-0.0.8.tar.gz",
    "platform": null,
    "description": "# cjm-pil-utils\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n``` sh\npip install cjm_pil_utils\n```\n\n## How to use\n\n### get_img_files\n\n``` python\nfrom cjm_pil_utils.core import get_img_files\nfrom pathlib import Path\n```\n\n``` python\nimg_dir = Path('../images/')\nimg_paths = get_img_files(img_dir)\nimg_paths\n```\n\n    [PosixPath('../images/cat.jpg'), PosixPath('../images/depth-cat.png')]\n\n### resize_img\n\n``` python\nfrom cjm_pil_utils.core import resize_img\nfrom PIL import Image  # For working with images\n```\n\n``` python\nimg_path = img_paths[0]\nsrc_img = Image.open(img_path).convert('RGB')\nprint(f\"Image Size: {src_img.size}\")\n\nresized_img = resize_img(src_img, target_sz=384, divisor=32)\nprint(f\"New Image Size: {resized_img.size}\")\n```\n\n    Image Size: (768, 512)\n    New Image Size: (576, 384)\n\n### stack_imgs\n\n``` python\nfrom cjm_pil_utils.core import stack_imgs\n```\n\n``` python\nstacked_imgs = stack_imgs([resized_img, resized_img])\nprint(f\"Stacked Image Size: {stacked_imgs.size}\")\n```\n\n    Stacked Image Size: (576, 768)\n\n### avg_images\n\n``` python\nfrom cjm_pil_utils.core import avg_images\n```\n\n``` python\nimg_1, img_2 = (Image.open(path) for path in img_paths)\navg_img = avg_images(img_1, img_2, 0.5)\n```\n\n### crop_square\n\n``` python\nfrom cjm_pil_utils.core import crop_square\n```\n\n``` python\ncrop_square(src_img).size\n```\n\n    (512, 512)\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Some PIL utility functions I frequently use.",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/cj-mills/cjm-pil-utils"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f99b44694aef8480cace2c93de8c3ebfe87a790e2586c141bddecfd682e778e6",
                "md5": "d388b8da365e372bd0ea2b72fe23e9d3",
                "sha256": "3689cd2245ba6fd33bbb0fc661f0c7446e7da8199a385d2945f68abb0a5f7277"
            },
            "downloads": -1,
            "filename": "cjm_pil_utils-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d388b8da365e372bd0ea2b72fe23e9d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8039,
            "upload_time": "2024-02-06T19:29:58",
            "upload_time_iso_8601": "2024-02-06T19:29:58.295344Z",
            "url": "https://files.pythonhosted.org/packages/f9/9b/44694aef8480cace2c93de8c3ebfe87a790e2586c141bddecfd682e778e6/cjm_pil_utils-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f91965c8d86545b5c9ad066c0be5c095e6af8956689015bf0e7540ffd9214001",
                "md5": "57abaf1c0033092566acb881cc9173ad",
                "sha256": "a516a613c5d5070920a901a38f1eb36e176ba66754964b274cf13dc17e05546b"
            },
            "downloads": -1,
            "filename": "cjm-pil-utils-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "57abaf1c0033092566acb881cc9173ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8111,
            "upload_time": "2024-02-06T19:29:59",
            "upload_time_iso_8601": "2024-02-06T19:29:59.453245Z",
            "url": "https://files.pythonhosted.org/packages/f9/19/65c8d86545b5c9ad066c0be5c095e6af8956689015bf0e7540ffd9214001/cjm-pil-utils-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 19:29:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cj-mills",
    "github_project": "cjm-pil-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cjm-pil-utils"
}
        
Elapsed time: 0.20902s