{"id":26161674,"url":"https://github.com/patryk27/linez","last_synced_at":"2025-04-14T12:24:25.558Z","repository":{"id":271762520,"uuid":"914492421","full_name":"Patryk27/linez","owner":"Patryk27","description":"Approximate images usings lines","archived":false,"fork":false,"pushed_at":"2025-01-11T19:03:47.000Z","size":10341,"stargazers_count":66,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T06:44:58.887Z","etag":null,"topics":["art","image","image-processing","rust"],"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/Patryk27.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":"2025-01-09T17:47:45.000Z","updated_at":"2025-02-05T09:35:46.000Z","dependencies_parsed_at":"2025-01-10T10:50:00.405Z","dependency_job_id":null,"html_url":"https://github.com/Patryk27/linez","commit_stats":null,"previous_names":["patryk27/linez"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patryk27%2Flinez","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patryk27%2Flinez/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patryk27%2Flinez/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Patryk27%2Flinez/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Patryk27","download_url":"https://codeload.github.com/Patryk27/linez/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248879110,"owners_count":21176438,"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":["art","image","image-processing","rust"],"created_at":"2025-03-11T12:53:16.654Z","updated_at":"2025-04-14T12:24:25.471Z","avatar_url":"https://github.com/Patryk27.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linez\n\nQuick \u0026 fun tool that approximates images using lines:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"512\" src=\"_readme/starry-night.jpg\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"512\" src=\"_readme/photo.jpg\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg height=\"512\" src=\"_readme/rust.jpg\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\n``` shell\n$ git clone https://github.com/Patryk27/linez\n$ cd linez\n$ cargo run --release -- images/starry-night.jpg\n# (press escape to close the app)\n```\n\n## Algorithm\n\n1. Load image provided by user (aka the target image).\n2. Create a black image (aka the approximated image).\n3. Sample a line: randomize starting point, ending point, and color.\n4. Check if drawing this line on the approximated image would reduce _the distance_ between the approximated image and the target image.\n5. If so, draw the line; otherwise don't draw it.\n6. Go to 3.\n\n... where \"distance between images\" is e.g. mean squared error:\n\n```\nfn image_distance(img_a, img_b):\n    assert img_a.size() == img_b.size()\n    \n    dist = 0.0\n    \n    for all pixels in img_a and img_b:\n        dist += pixel_distance(pixel_a, pixel_b)\n        \n    return dist\n\nfn pixel_distance(pixel_a, pixel_b):\n    dist_r = (pixel_a.red - pixel_b.red) ^ 2\n    dist_g = (pixel_a.green - pixel_b.green) ^ 2\n    dist_b = (pixel_a.blue - pixel_b.blue) ^ 2\n    \n    return dist_r + dist_g + dist_b\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2024 Patryk Wychowaniec\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatryk27%2Flinez","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatryk27%2Flinez","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatryk27%2Flinez/lists"}