pic2square2icon


Namepic2square2icon JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/pic2square2icon
Summary2 functions that provide convenient and efficient ways to resize images to a square with custom backgrounds and convert images to the ICO format
upload_time2023-06-27 04:29:15
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords ico convert posts
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 2 functions that provide convenient and efficient ways to resize images to a square with custom backgrounds and convert images to the ICO format

## pip install pic2square2icon

### Tested against Windows 10 / Python 3.10 / Anaconda 

The functions resize_with_background and pic2ico can be used by developers or individuals who work with 
image processing or need to manipulate images for various purposes. Here are some potential use cases for each function:

### resize_with_background:

- Graphic designers who want to resize an image to a specific size (square) while maintaining its aspect ratio and adding a background

- Web developers who need to generate thumbnail images with a consistent size and background for their websites.
- Content creators who want to resize and add a background to their images for social media posts (instagram or facebook timeline) or presentations.


### pic2ico:

- Software developers who need to convert image files to the ICO (icon) format for use in applications or software interfaces.
- Designers who want to create custom icons from their existing image assets.
- System administrators or IT professionals who need to generate ICO files for use as desktop icons or shortcuts.



```python

from pic2square2icon import resize_with_background, pic2ico
import cv2

test = 1
fg = r"C:\test\fg.png"
bg = r"C:\test\bg.png"
target_size = 512
resized_image = resize_with_background(fg, target_size, bg)
pic2ico(src=resized_image, dst=rf"C:\test\{test}.ico")
resized_image.save(rf"C:\test\{test}.png")


test = 2
fg = r"C:\test\fg.png"
bg = "orange"
target_size = 512
resized_image = resize_with_background(fg, target_size, bg)
pic2ico(src=resized_image, dst=rf"C:\test\{test}.ico")
resized_image.save(rf"C:\test\{test}.png")

test = 3
fg = r"C:\test\fg.png"
bg = (255, 255, 0)
target_size = 512
resized_image = resize_with_background(fg, target_size, bg)
pic2ico(src=resized_image, dst=rf"C:\test\{test}.ico")
resized_image.save(rf"C:\test\{test}.png")

test = 4
fg = r"C:\test\bg.png"
bg = cv2.imread(r"C:\test\fg.png")
target_size = 512
resized_image = resize_with_background(fg, target_size, bg, background_ratio=2)
pic2ico(src=resized_image, dst=rf"C:\test\{test}.ico")
resized_image.save(rf"C:\test\{test}.png")

test = 5
fg = r"C:\test\fg.png"
bg = None
target_size = 512
resized_image = resize_with_background(fg, target_size, bg, background_ratio=2)
resized_image.save(rf"C:\test\{test}.png")
pic2ico(src=resized_image, dst=rf"C:\test\{test}.ico")

```



#### bg.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/bg.png?raw=true)



#### fg.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/fg.png?raw=true)



#### 1.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/1.png?raw=true)



#### 2.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/2.png?raw=true)



#### 3.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/3.png?raw=true)



#### 4.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/4.png?raw=true)


#### 5.png

![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/5.png?raw=true)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/pic2square2icon",
    "name": "pic2square2icon",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ico,convert,posts",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/17/e0/0415f89970c1e12ea96cd3cc6be73cb6b6d8eb78ec1b199cf2369766cbfd/pic2square2icon-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# 2 functions that provide convenient and efficient ways to resize images to a square with custom backgrounds and convert images to the ICO format\r\n\r\n## pip install pic2square2icon\r\n\r\n### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\nThe functions resize_with_background and pic2ico can be used by developers or individuals who work with \r\nimage processing or need to manipulate images for various purposes. Here are some potential use cases for each function:\r\n\r\n### resize_with_background:\r\n\r\n- Graphic designers who want to resize an image to a specific size (square) while maintaining its aspect ratio and adding a background\r\n\r\n- Web developers who need to generate thumbnail images with a consistent size and background for their websites.\r\n- Content creators who want to resize and add a background to their images for social media posts (instagram or facebook timeline) or presentations.\r\n\r\n\r\n### pic2ico:\r\n\r\n- Software developers who need to convert image files to the ICO (icon) format for use in applications or software interfaces.\r\n- Designers who want to create custom icons from their existing image assets.\r\n- System administrators or IT professionals who need to generate ICO files for use as desktop icons or shortcuts.\r\n\r\n\r\n\r\n```python\r\n\r\nfrom pic2square2icon import resize_with_background, pic2ico\r\nimport cv2\r\n\r\ntest = 1\r\nfg = r\"C:\\test\\fg.png\"\r\nbg = r\"C:\\test\\bg.png\"\r\ntarget_size = 512\r\nresized_image = resize_with_background(fg, target_size, bg)\r\npic2ico(src=resized_image, dst=rf\"C:\\test\\{test}.ico\")\r\nresized_image.save(rf\"C:\\test\\{test}.png\")\r\n\r\n\r\ntest = 2\r\nfg = r\"C:\\test\\fg.png\"\r\nbg = \"orange\"\r\ntarget_size = 512\r\nresized_image = resize_with_background(fg, target_size, bg)\r\npic2ico(src=resized_image, dst=rf\"C:\\test\\{test}.ico\")\r\nresized_image.save(rf\"C:\\test\\{test}.png\")\r\n\r\ntest = 3\r\nfg = r\"C:\\test\\fg.png\"\r\nbg = (255, 255, 0)\r\ntarget_size = 512\r\nresized_image = resize_with_background(fg, target_size, bg)\r\npic2ico(src=resized_image, dst=rf\"C:\\test\\{test}.ico\")\r\nresized_image.save(rf\"C:\\test\\{test}.png\")\r\n\r\ntest = 4\r\nfg = r\"C:\\test\\bg.png\"\r\nbg = cv2.imread(r\"C:\\test\\fg.png\")\r\ntarget_size = 512\r\nresized_image = resize_with_background(fg, target_size, bg, background_ratio=2)\r\npic2ico(src=resized_image, dst=rf\"C:\\test\\{test}.ico\")\r\nresized_image.save(rf\"C:\\test\\{test}.png\")\r\n\r\ntest = 5\r\nfg = r\"C:\\test\\fg.png\"\r\nbg = None\r\ntarget_size = 512\r\nresized_image = resize_with_background(fg, target_size, bg, background_ratio=2)\r\nresized_image.save(rf\"C:\\test\\{test}.png\")\r\npic2ico(src=resized_image, dst=rf\"C:\\test\\{test}.ico\")\r\n\r\n```\r\n\r\n\r\n\r\n#### bg.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/bg.png?raw=true)\r\n\r\n\r\n\r\n#### fg.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/fg.png?raw=true)\r\n\r\n\r\n\r\n#### 1.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/1.png?raw=true)\r\n\r\n\r\n\r\n#### 2.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/2.png?raw=true)\r\n\r\n\r\n\r\n#### 3.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/3.png?raw=true)\r\n\r\n\r\n\r\n#### 4.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/4.png?raw=true)\r\n\r\n\r\n#### 5.png\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/create_ico/5.png?raw=true)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "2 functions that provide convenient and efficient ways to resize images to a square with custom backgrounds and convert images to the ICO format",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/pic2square2icon"
    },
    "split_keywords": [
        "ico",
        "convert",
        "posts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c66999af96d22c484f21da14e3d0eb0fe5092ae0a8c1644e8897f42a16ce68ed",
                "md5": "18a05edaf4a88e554fdaf2569d43ebf9",
                "sha256": "226274261bcf39bf9c0b2df7a9ea240930a2ea1a340af03da30883f114996da6"
            },
            "downloads": -1,
            "filename": "pic2square2icon-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "18a05edaf4a88e554fdaf2569d43ebf9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24803,
            "upload_time": "2023-06-27T04:29:13",
            "upload_time_iso_8601": "2023-06-27T04:29:13.493249Z",
            "url": "https://files.pythonhosted.org/packages/c6/69/99af96d22c484f21da14e3d0eb0fe5092ae0a8c1644e8897f42a16ce68ed/pic2square2icon-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17e00415f89970c1e12ea96cd3cc6be73cb6b6d8eb78ec1b199cf2369766cbfd",
                "md5": "d2817713ab71f8494a83a9776f5278a6",
                "sha256": "9fac99f3ff88041b56b6c9dde262d8c9b0d47a9fea9ccb53bd16ac7f0d7dee21"
            },
            "downloads": -1,
            "filename": "pic2square2icon-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "d2817713ab71f8494a83a9776f5278a6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24432,
            "upload_time": "2023-06-27T04:29:15",
            "upload_time_iso_8601": "2023-06-27T04:29:15.333111Z",
            "url": "https://files.pythonhosted.org/packages/17/e0/0415f89970c1e12ea96cd3cc6be73cb6b6d8eb78ec1b199cf2369766cbfd/pic2square2icon-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-27 04:29:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "pic2square2icon",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pic2square2icon"
}
        
Elapsed time: 0.10714s