{"id":20287723,"url":"https://github.com/yinxulai/imageswap","last_synced_at":"2025-04-11T09:58:25.015Z","repository":{"id":105805112,"uuid":"161007906","full_name":"yinxulai/ImageSwap","owner":"yinxulai","description":"image 与 JSON 之间互转的工具","archived":false,"fork":false,"pushed_at":"2020-02-27T08:52:40.000Z","size":6056,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-25T06:51:11.147Z","etag":null,"topics":["decode","go","golang","image","jpeg","jpg","json","png"],"latest_commit_sha":null,"homepage":"","language":"Go","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/yinxulai.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":"2018-12-09T05:33:20.000Z","updated_at":"2020-10-11T03:01:07.000Z","dependencies_parsed_at":"2023-06-14T01:15:27.615Z","dependency_job_id":null,"html_url":"https://github.com/yinxulai/ImageSwap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinxulai%2FImageSwap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinxulai%2FImageSwap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinxulai%2FImageSwap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yinxulai%2FImageSwap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yinxulai","download_url":"https://codeload.github.com/yinxulai/ImageSwap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248371933,"owners_count":21093123,"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":["decode","go","golang","image","jpeg","jpg","json","png"],"created_at":"2024-11-14T14:42:08.725Z","updated_at":"2025-04-11T09:58:24.998Z","avatar_url":"https://github.com/yinxulai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImageSwap\nImageSwap是一个便于简单图片研究的工具，它可以快速的把一张图片解析成为JSON文件或者将JSON还原成为一张图片。目前解析仅支持png、jpg、jpeg格式\n\n### 示例\n```\n//解码图片\nimageSwap -decode  -input ./image.png -output imagejson  -javascript ./script.js\n\n//编码图片\nimageSwap -encode  -input ./image.json -output imagejson \n```\n\n### 基本命令使用\n```\nGLOBAL OPTIONS:\n   --decode            从图片解码为JSON\n   --encode            将JSON编码为图片\n   --output value      输出文件名称 (default: \"outfile\")\n   --input value       输入文件路径\n   --javascript value  处理中间脚本路径\n   --help, -h          查看帮助\n   --version, -v       查看版本信息\n```\n\n### JSON格式示例\n```\n{\n    \"Width\": 50, //图片宽度\n    \"Height\": 50, //图片高度\n    \"Data\": [\n        {\n            \"X\": 0, //像素X位置 \n            \"Y\": 0, //像素Y位置\n            \"R\": 255, //像素R(red)色值\n            \"G\": 255, //像素G(green)色值\n            \"B\": 255, //像素B(blue)色值\n            \"A\": 255  //像素A(Alpha)通道值\n        },\n        {...},\n        ...\n    ]\n```\n\n### JavaScript 脚本示例\n脚本必须有一个main函数作为入口,main函数会接受一个img值，该值为图片的JSON数据，此外，main函数可以将修改的JSON数据返回,最终会影响输出。\n```\nfunction main(img) { \n    img.Data.map(function (point) {\n    })\n    return img\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyinxulai%2Fimageswap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyinxulai%2Fimageswap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyinxulai%2Fimageswap/lists"}