{"id":15496053,"url":"https://github.com/keiya01/og_image_writer","last_synced_at":"2025-08-21T08:31:23.185Z","repository":{"id":38140359,"uuid":"401173932","full_name":"keiya01/og_image_writer","owner":"keiya01","description":"Generate Open Graphic Image with CSS-like API.","archived":false,"fork":false,"pushed_at":"2022-11-17T07:58:36.000Z","size":9020,"stargazers_count":59,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-10T08:51:22.927Z","etag":null,"topics":["css","html","ogp-image","rust","wasm","web","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keiya01.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}},"created_at":"2021-08-30T00:42:26.000Z","updated_at":"2024-11-02T18:11:06.000Z","dependencies_parsed_at":"2022-09-20T23:20:15.792Z","dependency_job_id":null,"html_url":"https://github.com/keiya01/og_image_writer","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keiya01%2Fog_image_writer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keiya01%2Fog_image_writer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keiya01%2Fog_image_writer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keiya01%2Fog_image_writer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keiya01","download_url":"https://codeload.github.com/keiya01/og_image_writer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230501172,"owners_count":18236061,"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":["css","html","ogp-image","rust","wasm","web","webassembly"],"created_at":"2024-10-02T08:21:55.855Z","updated_at":"2024-12-19T21:10:10.744Z","avatar_url":"https://github.com/keiya01.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open Graphic Image Writer\n\n[Documentation](https://crates.io/crates/og_image_writer)\n\nYou can generate Open Graphic Image dynamically.\n\n- A CSS-like API.\n- You can generate image by using template image.\n- WASM/WASI support.\n\n## Problem\n\nCurrently, when you want to create OGP image dynamically, you may use canvas. But to use canvas, you need to open a browser and run some script.\nThis has overhead for memory usage and rendering performance.\nTherefore this lib is targeting a high performance API for all platform(including the edge) by using wasm.\n\n## Example\n\nFor more examples, see [keiya01/og_image_writer/examples](https://github.com/keiya01/og_image_writer/tree/main/examples).\n\n```rust\nuse og_image_writer::{style, writer::OGImageWriter};\nuse std::path::Path;\n\nfn main() -\u003e anyhow::Result\u003c()\u003e {\n    let text = \"This is Open Graphic Image Writer for Web Developer.\";\n\n    let mut writer = OGImageWriter::new(style::WindowStyle {\n        width: 1024,\n        height: 512,\n        background_color: Some(style::Rgba([70, 40, 90, 255])),\n        align_items: style::AlignItems::Center,\n        justify_content: style::JustifyContent::Center,\n        ..style::WindowStyle::default()\n    })?;\n\n    let font = Vec::from(include_bytes!(\"../fonts/Mplus1-Black.ttf\") as \u0026[u8]);\n\n    writer.set_text(\n        text,\n        style::Style {\n            margin: style::Margin(0, 20, 0, 20),\n            line_height: 1.8,\n            font_size: 100.,\n            word_break: style::WordBreak::Normal,\n            color: style::Rgba([255, 255, 255, 255]),\n            text_align: style::TextAlign::Start,\n            ..style::Style::default()\n        },\n        font,\n    )?;\n\n    let out_dir = \"./examples\";\n    let out_filename = \"output_background_color.png\";\n\n    writer.generate(Path::new(\u0026format!(\"{}/{}\", out_dir, out_filename)))?;\n\n    Ok(())\n}\n```\n\nWhen you pass the following the template image,\n\n![example template image](https://raw.githubusercontent.com/keiya01/og_image_writer/main/assets/og_template.png)\n\nthis code generate the following image.\n\n![example output image](https://raw.githubusercontent.com/keiya01/og_image_writer/main/dev/snapshots/output_background_image.png)\n\nAnd you can also set `background-color` instead of passing the template image.\n\nFor more complex examples, see [keiya01/og_image_writer/examples](https://github.com/keiya01/og_image_writer/tree/main/examples).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeiya01%2Fog_image_writer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeiya01%2Fog_image_writer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeiya01%2Fog_image_writer/lists"}