# Creates a collage from images with OpenCV
## pip install cv2-collage-v2
# Tested against Windows 10 / Python 3.10 / Anaconda
## How to use it
```python
from cv2_collage_v2 import create_collage_v2
import os
import cv2
folder=r'C:\Users\hansc\Downloads\bd'
allpics =[]
for f in os.listdir(folder):
try:
allpics.append(cv2.imread(os.path.join(folder,f)))
except Exception as fe:
print(fe)
continue
collage=create_collage_v2(allpics,maxwidth = 1500,heightdiv=16,widthdiv=5,background=(0, 0, 0),save_path='e:\\nyhctest.png',)
cv2.imshow('Collage', collage)
cv2.waitKey(0)
cv2.destroyAllWindows()
Args:
lst (list|tuple): A list or tuple of images - allowed: [file paths, base64, bytes, PIL, urls, np.array].
maxwidth (int, optional): The maximum width of the collage. Defaults to 1080.
heightdiv (int, optional): The height division factor. Defaults to 6.
widthdiv (int, optional): The width division factor. Defaults to 2.
background (tuple, optional): The background color of the collage. Defaults to (0, 0, 0).
save_path (str|None, optional): The file path to save the collage. Defaults to None.
Returns:
np.array: A NumPy array representing the collage image.
```
![](https://github.com/hansalemaos/screenshots/blob/main/nyhctest.png?raw=true)
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/cv2_collage_v2",
"name": "cv2-collage-v2",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "collage,opencv",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/48/03/338e2592cb17fc9b5c401f588fce71058b3f7e9cff7bdf7840190853ec35/cv2_collage_v2-0.11.tar.gz",
"platform": null,
"description": "# Creates a collage from images with OpenCV\r\n\r\n## pip install cv2-collage-v2 \r\n\r\n# Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n## How to use it\r\n\r\n```python\r\nfrom cv2_collage_v2 import create_collage_v2\r\nimport os\r\nimport cv2\r\nfolder=r'C:\\Users\\hansc\\Downloads\\bd'\r\nallpics =[]\r\nfor f in os.listdir(folder):\r\n try:\r\n allpics.append(cv2.imread(os.path.join(folder,f)))\r\n except Exception as fe:\r\n print(fe)\r\n continue\r\n\r\ncollage=create_collage_v2(allpics,maxwidth = 1500,heightdiv=16,widthdiv=5,background=(0, 0, 0),save_path='e:\\\\nyhctest.png',)\r\n\r\ncv2.imshow('Collage', collage)\r\ncv2.waitKey(0)\r\ncv2.destroyAllWindows()\r\n\r\n\r\n\r\n Args:\r\n lst (list|tuple): A list or tuple of images - allowed: [file paths, base64, bytes, PIL, urls, np.array].\r\n maxwidth (int, optional): The maximum width of the collage. Defaults to 1080.\r\n heightdiv (int, optional): The height division factor. Defaults to 6.\r\n widthdiv (int, optional): The width division factor. Defaults to 2.\r\n background (tuple, optional): The background color of the collage. Defaults to (0, 0, 0).\r\n save_path (str|None, optional): The file path to save the collage. Defaults to None.\r\n\r\n Returns:\r\n np.array: A NumPy array representing the collage image.\r\n\r\n```\r\n\r\n\r\n![](https://github.com/hansalemaos/screenshots/blob/main/nyhctest.png?raw=true)\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Creates a collage from images with OpenCV",
"version": "0.11",
"split_keywords": [
"collage",
"opencv"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "534ed7187db5a1323b42b2e227afb04b35e96e97471772a1647790824350b9d4",
"md5": "83ede49c3a77a625518d5effabdbee15",
"sha256": "dd14155edf6da6a193df8df5922327a51c3b1c0fce96565ec909233739bd8005"
},
"downloads": -1,
"filename": "cv2_collage_v2-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83ede49c3a77a625518d5effabdbee15",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21963,
"upload_time": "2023-04-23T12:06:28",
"upload_time_iso_8601": "2023-04-23T12:06:28.166111Z",
"url": "https://files.pythonhosted.org/packages/53/4e/d7187db5a1323b42b2e227afb04b35e96e97471772a1647790824350b9d4/cv2_collage_v2-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4803338e2592cb17fc9b5c401f588fce71058b3f7e9cff7bdf7840190853ec35",
"md5": "e309c616aa0598f8570efff216937bf0",
"sha256": "68819975f25370ba04f6ef7bf5762c5ea61cb2a8a5c5aa537fb62547b14066de"
},
"downloads": -1,
"filename": "cv2_collage_v2-0.11.tar.gz",
"has_sig": false,
"md5_digest": "e309c616aa0598f8570efff216937bf0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20775,
"upload_time": "2023-04-23T12:06:30",
"upload_time_iso_8601": "2023-04-23T12:06:30.829318Z",
"url": "https://files.pythonhosted.org/packages/48/03/338e2592cb17fc9b5c401f588fce71058b3f7e9cff7bdf7840190853ec35/cv2_collage_v2-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-23 12:06:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "cv2_collage_v2",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "a_cv2_easy_resize",
"specs": []
},
{
"name": "a_cv_imwrite_imread_plus",
"specs": []
},
{
"name": "create_empty_image",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "opencv_python",
"specs": []
},
{
"name": "rectangle_packer",
"specs": []
}
],
"lcname": "cv2-collage-v2"
}