{"id":13771767,"url":"https://github.com/bcmi/libcom","last_synced_at":"2025-12-14T14:01:33.906Z","repository":{"id":204218101,"uuid":"707033939","full_name":"bcmi/libcom","owner":"bcmi","description":"Image composition toolbox: everything you want to know about image composition or object insertion","archived":false,"fork":false,"pushed_at":"2025-11-25T07:00:56.000Z","size":75266,"stargazers_count":699,"open_issues_count":0,"forks_count":50,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-11-28T14:44:23.933Z","etag":null,"topics":["cross-domain-image-composition","foreground-object-search","generative-image-composition","image-blending","image-composition","image-composition-library","image-composition-toolbox","image-harmonization","inharmonious-region-localization","object-insertion","object-placement","painterly-image-harmonization","shadow-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcmi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-19T05:08:12.000Z","updated_at":"2025-11-26T12:08:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"6dbe5a67-d593-45dd-b842-b8a86ad046a3","html_url":"https://github.com/bcmi/libcom","commit_stats":null,"previous_names":["bcmi/libcom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcmi/libcom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcmi%2Flibcom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcmi%2Flibcom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcmi%2Flibcom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcmi%2Flibcom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcmi","download_url":"https://codeload.github.com/bcmi/libcom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcmi%2Flibcom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27729428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-domain-image-composition","foreground-object-search","generative-image-composition","image-blending","image-composition","image-composition-library","image-composition-toolbox","image-harmonization","inharmonious-region-localization","object-insertion","object-placement","painterly-image-harmonization","shadow-generation"],"created_at":"2024-08-03T17:00:55.270Z","updated_at":"2025-12-14T14:01:33.900Z","avatar_url":"https://github.com/bcmi.png","language":"Python","funding_links":[],"categories":["Toolbox","Industry Strength Computer Vision"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n\u003c/br\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/bcmi/libcom/main/resources/LOGO.png\" width=\"200\" /\u003e\r\n\r\n\u003c/div\u003e\r\n\r\n\u003ch1 align=\"center\"\u003elibcom: everything about image composition\u003c/h1\u003e\r\n\r\n\u003c/br\u003e\r\n\r\n[![PyPI](https://img.shields.io/pypi/v/libcom)](https://pypi.org/project/libcom)\r\n[![Downloads](https://static.pepy.tech/badge/libcom)](https://pepy.tech/project/libcom)\r\n[![Hits](https://hits.sh/github.com/bcmi/libcom.svg?label=views)](https://hits.sh/github.com/bcmi/libcom/)\r\n[![Static Badge](https://img.shields.io/badge/Online_Workbench-yellow)](http://libcom.ustcnewly.com/)\r\n[![Static Badge](https://img.shields.io/badge/Dataset\u0026Code_Resources-green)](https://github.com/bcmi/Awesome-Object-Insertion)\r\n[![Static Badge](https://img.shields.io/badge/survey-arxiv%3A2106.14490-red)](https://arxiv.org/pdf/2106.14490.pdf)\r\n[![Static Badge](https://img.shields.io/github/stars/bcmi/libcom.svg?style=social)](https://github.com/bcmi/libcom/stargazers)\r\n\r\n\r\n---\r\n\r\n## Introduction\r\n**_libcom_ (the library of image composition) is an image composition toolbox.** The goal of [image composition](https://github.com/bcmi/Awesome-Image-Composition) ([object insertion](https://github.com/bcmi/Awesome-Object-Insertion)) is inserting one foreground into a background image to get a realistic composite image, by addressing the inconsistencies (appearance, geometry, and semantic inconsistency) between foreground and background. Generally speaking, image composition could be used to combine the visual elements from different images.\r\n\u003cdiv align=\"center\"\u003e\r\n\u003c/br\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/bcmi/libcom/main/resources/image_composition_task.gif\" width=\"600\" /\u003e\r\n\u003c/div\u003e\r\n\r\n**_libcom_ covers a diversity of related tasks in the field of image composition**, including image blending, standard/painterly image harmonization, shadow generation, object placement, generative composition, quality evaluation, *etc*. For each task, we integrate one or two selected methods considering both efficiency and effectiveness. The selected methods will be continuously updated upon the emergence of better methods. \r\n\r\n**The ultimate goal of this library is solving all the problems related to image composition with simple `import libcom`.**\r\n\r\nWelcome to follow WeChat public account [\"Newly AIGCer\"](https://www.ustcnewly.com/blog.html) or Zhihu Column [\"Newly CVer\"](https://www.zhihu.com/column/c_1333918224900206592) to get the latest information about image composition! \r\n\r\n## Online Workbench\r\n\r\nWe have built the [image composition workbench](http://libcom.ustcnewly.com/) based on our Libcom toolbox. The interface is as follows:\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\u003c/br\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/bcmi/libcom/main/resources/online_workbench.jpg\" width=\"1000\" /\u003e\r\n\u003c/div\u003e\r\n\r\n\r\n## Main Functions\r\n\r\n- **get_composite_image** generates composite images using naive copy-and-paste followed by image blending.\r\n- **OPAScoreModel** [[OPA]](https://github.com/bcmi/Object-Placement-Assessment-Dataset-OPA) evaluates the rationality of foreground object placement in a composite image.\r\n- **FOPAHeatMapModel** [[FOPA]](https://github.com/bcmi/FOPA-Fast-Object-Placement-Assessment) can predict the rationality scores for all locations/scales given a background-foreground pair, and output the composite image with optimal location/scale.  \r\n- **color_transfer** adjusts the foreground color to match the background using traditional color transfer method.\r\n- **ImageHarmonizationModel** [[PCTNet]](https://github.com/rakutentech/PCT-Net-Image-Harmonization) adjusts the foreground illumination to be compatible the background given photorealistic background and photorealistic foreground.\r\n- **PainterlyHarmonizationModel** [[PHDNet]](https://github.com/bcmi/PHDNet-Painterly-Image-Harmonization)  [[PHDiffusion]](https://github.com/bcmi/PHDiffusion-Painterly-Image-Harmonization) adjusts the foreground style to be compatible with the background given artistic background and photorealistic foreground.\r\n- **HarmonyScoreModel** [[BargainNet]](https://github.com/bcmi/BargainNet-Image-Harmonization) evaluates the harmony level between foreground and background in a composite image.\r\n- **InharmoniousLocalizationModel** [[MadisNet]](https://github.com/bcmi/MadisNet-Inharmonious-Region-Localization) localizes the inharmonious region in a synthetic image.\r\n- **FOSScoreModel** [[DiscoFOS]](https://github.com/bcmi/Foreground-Object-Search-Dataset-FOSD) evaluates the compatibility between foreground and background in a composite image in terms of geometry and semantics. Due to limited training data, the generalization ability of this model is poor. \r\n- **ShadowGenerationModel** [[GPSDiffusion]](https://github.com/bcmi/GPSDiffusion-Object-Shadow-Generation) generates plausible shadow for the inserted object in a composite image. \r\n- **ReflectionGenerationModel** generates plausible reflection for the inserted object in a composite image. \r\n- **KontextBlendingHarmonizationModel** [[FluxKontext]](https://github.com/black-forest-labs/flux) is a generative image composition model which inserts foreground into the specified bounding box in the background. The pose and view of foreground stay unchanged. The \"blending\" mode does not adjust the foreground illumination, while the \"harmonization\" mode adjusts the foreground illumination to make the composite image harmonious. \r\n- **InsertAnythingModel** [[InsertAnything]](https://github.com/song-wensong/insert-anything) is a generative image composition model which inserts foreground into the specified bounding box in the background. The model has reasonable ability to adjust the pose and view of foreground according to the background. \r\n\r\n\r\n**For the detailed method descriptions, code examples, visualization results, and performance comments, please refer to our [[documents]](https://libcom.readthedocs.io/en/latest/).** If the model performance is not satisfactory, you can finetune the pretrained model on your own dataset using the source repository and replace the original model. \r\n\r\n## Requirements\r\n\r\nThe main branch is built on the Linux system with **Python 3.10** and **PyTorch\u003e=2.6**. For other dependencies, please refer to [[requirements]](https://github.com/bcmi/libcom/blob/main/requirements.txt).\r\n\r\n## Get Started\r\nPlease refer to [[Installation]](https://github.com/bcmi/libcom/blob/main/docs/get_started.md) for installation instructions and [[documents]](https://libcom.readthedocs.io/en/latest/) for user guidance.\r\n\r\n## Contributors\r\n- Institution: [Brain-like Computing and Machine Intelligence (BCMI) Lab](https://bcmi.sjtu.edu.cn/).\r\n- Project Initiator \u0026 Team Manager: [Li Niu](https://www.ustcnewly.com/index.html). \r\n- Architect \u0026 Lead Developer: [Bo Zhang](https://bo-zhang-cs.github.io/), [Yujie Zhou](https://github.com/YujieOuO).\r\n- Documentation Manager: [Jiacheng Sui](https://github.com/charlessjc).\r\n- Module Developers: [Jiacheng Sui](https://github.com/charlessjc), [Bingjie Gao](https://github.com/WhynotHAHA), [Lingxiao Lu](https://github.com/pokaaa), [Xinhao Tao](https://github.com/taoxinhao13), [Junyan Cao](https://github.com/cjy-4), [Haonan Zhao](https://github.com/nononononno), [Jiaxuan Chen](https://github.com/csdahunzi), [Junqi You](https://github.com/dhmbb2).\r\n\r\n## License\r\n\r\nThis project is released under the [Apache 2.0 license](https://github.com/bcmi/libcom/blob/main/LICENSE).\r\n\r\n## Bibtex\r\n\r\nIf you use our toolbox, please cite our survey paper using the following BibTeX  [[arxiv](https://arxiv.org/pdf/2106.14490.pdf)]:\r\n\r\n```\r\n@article{niu2021making,\r\n  title={Making images real again: A comprehensive survey on deep image composition},\r\n  author={Niu, Li and Cong, Wenyan and Liu, Liu and Hong, Yan and Zhang, Bo and Liang, Jing and Zhang, Liqing},\r\n  journal={arXiv preprint arXiv:2106.14490},\r\n  year={2021}\r\n}\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcmi%2Flibcom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcmi%2Flibcom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcmi%2Flibcom/lists"}