{"id":24555761,"url":"https://github.com/rwxbytes/stability_rs","last_synced_at":"2025-08-09T23:07:44.106Z","repository":{"id":196846084,"uuid":"684729111","full_name":"rwxbytes/stability_rs","owner":"rwxbytes","description":"A Rust lib crate for Stability.ai","archived":false,"fork":false,"pushed_at":"2023-09-27T17:31:28.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T17:36:59.595Z","etag":null,"topics":["ai","api","stable-diffusion","text-to-image"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwxbytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-08-29T18:25:33.000Z","updated_at":"2023-11-17T16:11:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef24e0eb-32a8-4945-9ba6-cf30e7d51778","html_url":"https://github.com/rwxbytes/stability_rs","commit_stats":null,"previous_names":["rwxbytes/stability_rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwxbytes/stability_rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwxbytes%2Fstability_rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwxbytes%2Fstability_rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwxbytes%2Fstability_rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwxbytes%2Fstability_rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwxbytes","download_url":"https://codeload.github.com/rwxbytes/stability_rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwxbytes%2Fstability_rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269649848,"owners_count":24453541,"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-08-09T02:00:10.424Z","response_time":111,"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":["ai","api","stable-diffusion","text-to-image"],"created_at":"2025-01-23T04:20:02.067Z","updated_at":"2025-08-09T23:07:44.096Z","avatar_url":"https://github.com/rwxbytes.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"An unofficial Rust API client for [Stability-AI](https://stability.ai/) text-to-speech software.\n\n## ⚙️ Requirements\n\n- Set API key to environment variable `STABILITY_API_KEY`\n\n## 🗣️ Usage\n\n### Text to Image\n\n ```rust\n use stability_rs::{text_to_img::*, Result, ClipGuidancePreset, Sampler, StylePreset};\n\n    #[tokio::main]\n    async fn main() -\u003e Result\u003c()\u003e {\n        let image = TextToImageBuilder::new()\n            .height(1024)?\n            .width(1024)?\n            .cfg_scale(27)?\n            .clip_guidance_preset(ClipGuidancePreset::FastBlue)?\n            .sampler(Sampler::KDpmpp2sAncestral)?\n            .samples(2)?\n            .seed(0)?\n            .steps(33)?\n            .style_preset(StylePreset::DigitalArt)?\n            .text_prompt(\"A scholar tired at his desk, a raven on a bust\", 1.0)?\n            .build()?;\n\n        let resp = image.generate(\"stable-diffusion-xl-1024-v1-0\").await?;\n\n        for (i, image) in resp.artifacts.iter().enumerate() {\n            let _ = image.save(\u0026format!(\"image_{}.png\", i)).await?;\n        }\n\n        Ok(())\n    }\n  ```\n### Image to Image\n\n```rust\nuse stability_rs::{img_to_img::*, Result, ClipGuidancePreset, Sampler, StylePreset,};\n\n   #[tokio::main]\n   async fn main() -\u003e Result\u003c()\u003e {\n        let image = ImageToImageBuilder::new()\n           .init_image_path(\"init_image.png\")?\n           .init_image_mode(ImageMode::ImageStrength)?\n           .image_strength(0.35)?\n           .cfg_scale(7)?\n           .clip_guidance_preset(ClipGuidancePreset::FastBlue)?\n           .sampler(Sampler::KDpm2Ancestral)?\n           .samples(3)?\n           .seed(0)?\n           .steps(20)?\n           .style_preset(StylePreset::FantasyArt)?\n           .text_prompt(\"A crab relaxing on a beach\", 0.5)?\n           .text_prompt(\"stones\", -0.9)?\n           .build()?;\n        \n        let resp = image.generate(\"stable-diffusion-xl-1024-v1-0\").await?;\n        \n        for (i, img) in resp.artifacts.iter().enumerate() {\n            let _ = img.save(\u0026format!(\"new_image_{}.png\", i)).await?;\n        }\n        \n        Ok(())\n}\n```\n\n### Image Upscaling\n\n```rust\nuse stability_rs::{upscale::*, Result,};\n    \n     #[tokio::main]\n     async fn main() -\u003e Result\u003c()\u003e {\n        let image = UpscalerBuilder::new()\n           .image(\"1024_image.png\")?\n           .height(2048)?\n           .build()?;\n    \n        let resp = image.generate(UpscaleEngine::EsrganV1X2Plus).await?;\n    \n        resp.artifacts.first().unwrap().save(\"2048_image.png\").await?;\n    \n       Ok(())\n     }\n```\n\n### Image Masking\n\n```rust\nuse stability_rs::{masking::*, Result, StylePreset, ClipGuidancePreset};\n    \n     #[tokio::main]\n     async fn main() -\u003e Result\u003c()\u003e {\n        let engine = \"stable-inpainting-512-v2-0\";\n    \n        let image = MaskerBuilder::new()\n          .init_image_path(\"init_image.png\")?\n          .mask_source(MaskSource::MaskImageBlack)?\n          .mask_image(\"black_mask_image.png\")?\n          .text_prompt(\"a crab dancing\", 1.0)?\n          .style_preset(StylePreset::FantasyArt)?\n          .clip_guidance_preset(ClipGuidancePreset::FastBlue)?\n          .build()?;\n    \n        let resp = image.generate(engine).await?;\n    \n        resp.artifacts.first().unwrap().save(\"masked_image.png\").await?;\n    \n        Ok(())\n     }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwxbytes%2Fstability_rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwxbytes%2Fstability_rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwxbytes%2Fstability_rs/lists"}