{"id":13622262,"url":"https://github.com/lkwq007/stablediffusion-infinity","last_synced_at":"2025-05-14T23:04:44.349Z","repository":{"id":59348576,"uuid":"531788813","full_name":"lkwq007/stablediffusion-infinity","owner":"lkwq007","description":"Outpainting with Stable Diffusion on an infinite canvas","archived":false,"fork":false,"pushed_at":"2023-05-16T12:20:16.000Z","size":17463,"stargazers_count":3876,"open_issues_count":95,"forks_count":303,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-13T19:49:57.655Z","etag":null,"topics":["gui","inpainting","outpainting","stable-diffusion","stablediffusion"],"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/lkwq007.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}},"created_at":"2022-09-02T05:07:50.000Z","updated_at":"2025-04-10T15:45:24.000Z","dependencies_parsed_at":"2024-01-07T03:52:17.646Z","dependency_job_id":"186ee19c-5732-4d9d-a97a-8ef7fe57cfde","html_url":"https://github.com/lkwq007/stablediffusion-infinity","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwq007%2Fstablediffusion-infinity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwq007%2Fstablediffusion-infinity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwq007%2Fstablediffusion-infinity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkwq007%2Fstablediffusion-infinity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkwq007","download_url":"https://codeload.github.com/lkwq007/stablediffusion-infinity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243358,"owners_count":22038046,"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","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":["gui","inpainting","outpainting","stable-diffusion","stablediffusion"],"created_at":"2024-08-01T21:01:16.826Z","updated_at":"2025-05-14T23:04:39.323Z","avatar_url":"https://github.com/lkwq007.png","language":"Python","readme":"# stablediffusion-infinity\n\nOutpainting with Stable Diffusion on an infinite canvas.\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/lkwq007/stablediffusion-infinity/blob/master/stablediffusion_infinity_colab.ipynb)\n[![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/lnyan/stablediffusion-infinity)\n[![Setup Locally](https://img.shields.io/badge/%F0%9F%96%A5%EF%B8%8F%20Setup-Locally-blue)](https://github.com/lkwq007/stablediffusion-infinity/blob/master/docs/setup_guide.md)\n\n![outpaint](https://user-images.githubusercontent.com/1665437/197257616-82c1e58f-7463-4896-8345-6750a828c844.png)\n\nhttps://user-images.githubusercontent.com/1665437/197244111-51884b3b-dffe-4dcf-a82a-fa5117c79934.mp4\n\n## Status\n\nPowered by Stable Diffusion inpainting model, this project now works well. However, the quality of results is still not guaranteed.\nYou may need to do prompt engineering, change the size of the selection, reduce the size of the outpainting region to get better outpainting results. \n\nThe project now becomes a web app based on PyScript and Gradio. For Jupyter Notebook version, please check out the [ipycanvas](https://github.com/lkwq007/stablediffusion-infinity/tree/ipycanvas) branch. \n\nPull requests are welcome for better UI control, ideas to achieve better results, or any other improvements.\n\nUpdate: the project add photometric correction to suppress seams, to use this feature, you need to install [fpie](https://github.com/Trinkle23897/Fast-Poisson-Image-Editing): `pip install fpie` (Linux/MacOS only)\n\n## Docs\n\n### Get Started\n\n- Setup for Windows: [setup_guide](./docs/setup_guide.md#windows)\n- Setup for Linux: [setup_guide](./docs/setup_guide.md#linux)\n- Setup for MacOS: [setup_guide](./docs/setup_guide.md#macos)\n- Running with Docker on Windows or Linux with NVIDIA GPU: [run_with_docker](./docs/run_with_docker.md)\n- Usages: [usage](./docs/usage.md)\n\n### FAQs\n\n- The result is a black square: \n  - False positive rate of safety checker is relatively high, you may disable the safety_checker\n  - Some GPUs might not work with `fp16`: `python app.py --fp32 --lowvram`\n- What is the init_mode\n  - init_mode indicates how to fill the empty/masked region, usually `patch_match` is better than others\n- Why not use `postMessage` for iframe interaction\n  - The iframe and the gradio are in the same origin. For `postMessage` version, check out [gradio-space](https://github.com/lkwq007/stablediffusion-infinity/tree/gradio-space) version\n\n### Known issues\n\n- The canvas is implemented with `NumPy` + `PyScript` (the project was originally implemented with `ipycanvas` inside a jupyter notebook), which is relatively inefficient compared with pure frontend solutions. \n- By design, the canvas is infinite. However, the canvas size is **finite** in practice. Your RAM and browser limit the canvas size. The canvas might crash or behave strangely when zoomed out by a certain scale. \n- The canvas requires internet: You can deploy and serve PyScript, Pyodide, and other JS/CSS assets with a local HTTP server and modify `index.html` accordingly. \n- Photometric correction might not work (`taichi` does not support the multithreading environment). A dirty hack (quite unreliable) is implemented to move related computation inside a subprocess. \n- Stable Diffusion inpainting model is much slower when selection size is larger than 512x512\n\n## Credit\n\nThe code of `perlin2d.py` is from https://stackoverflow.com/questions/42147776/producing-2d-perlin-noise-with-numpy/42154921#42154921 and is **not** included in the scope of LICENSE used in this repo.\n\nThe submodule `glid_3_xl_stable` is based on https://github.com/Jack000/glid-3-xl-stable \n\nThe submodule `PyPatchMatch` is based on https://github.com/vacancy/PyPatchMatch\n\nThe code of `postprocess.py` and `process.py` is modified based on https://github.com/Trinkle23897/Fast-Poisson-Image-Editing\n\nThe code of `convert_checkpoint.py` is modified based on https://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.py\n\nThe submodule `sd_grpcserver` and `handleImageAdjustment()` in `utils.py` are based on https://github.com/hafriedlander/stable-diffusion-grpcserver and https://github.com/parlance-zz/g-diffuser-bot\n\n`w2ui.min.js` and `w2ui.min.css` is from https://github.com/vitmalina/w2ui. `fabric.min.js` is a custom build of https://github.com/fabricjs/fabric.js\n\n`interrogate.py` is based on https://github.com/pharmapsychotic/clip-interrogator v1, the submodule `blip_model` is based on https://github.com/salesforce/BLIP \n","funding_links":[],"categories":["Python","Image Synthesis","Training"],"sub_categories":["Inbox: Stable Diffusion","GUIS"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkwq007%2Fstablediffusion-infinity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkwq007%2Fstablediffusion-infinity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkwq007%2Fstablediffusion-infinity/lists"}