{"id":13413204,"url":"https://github.com/noelyahan/mergi","last_synced_at":"2025-05-16T15:05:31.917Z","repository":{"id":57485305,"uuid":"150050476","full_name":"noelyahan/mergi","owner":"noelyahan","description":"go library for image programming (merge, crop, resize, watermark, animate, ease, transit)","archived":false,"fork":false,"pushed_at":"2024-11-05T05:58:08.000Z","size":26926,"stargazers_count":238,"open_issues_count":2,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-12T11:58:14.002Z","etag":null,"topics":["animate","crop","easing","gif","golang","image","merge","resize","transition","watermark"],"latest_commit_sha":null,"homepage":"http://mergi.io/","language":"Go","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/noelyahan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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-09-24T03:40:47.000Z","updated_at":"2025-04-08T00:41:12.000Z","dependencies_parsed_at":"2025-03-12T03:21:22.689Z","dependency_job_id":null,"html_url":"https://github.com/noelyahan/mergi","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/noelyahan%2Fmergi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelyahan%2Fmergi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelyahan%2Fmergi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noelyahan%2Fmergi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noelyahan","download_url":"https://codeload.github.com/noelyahan/mergi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553959,"owners_count":22090417,"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":["animate","crop","easing","gif","golang","image","merge","resize","transition","watermark"],"created_at":"2024-07-30T20:01:35.100Z","updated_at":"2025-05-16T15:05:31.859Z","avatar_url":"https://github.com/noelyahan.png","language":"Go","funding_links":[],"categories":["Libraries/tools","Relational Databases","Images","Go","Images 图像处理","图像","图片"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","SQL 查询语句构建库","交流","检索及分析资料库"],"readme":"![Mergi](./logo/logo.png)\n\n\u003cp\u003e\n  \u003cimg src=\"https://img.shields.io/badge/imaging-4%20terminal%20lovers-00afef.svg?longCache=true\u0026style=for-the-badge\"/\u003e\n\u003c/p\u003e\n\nResult                    | Terminal Code\n-----------------------------------|------------------------------------------\n![Intro](https://i.imgur.com/UmbQ5CJ.gif) | `mergi -t TT -i https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Facepalm_Gopher.png -r \"131 131\" -i https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Facepalm_Picard_Gopher.png -r \"131 131\" -a \"sprite 50\"`\n\n[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/noelyahan/mergi)\n[![Build Status](https://travis-ci.com/noelyahan/mergi.svg?branch=master)](https://travis-ci.com/noelyahan/mergi)\n[![codecov](https://codecov.io/gh/noelyahan/mergi/branch/master/graph/badge.svg)](https://codecov.io/gh/noelyahan/mergi)\n[![Go Report Card](https://goreportcard.com/badge/github.com/noelyahan/mergi)](https://goreportcard.com/report/github.com/noelyahan/mergi)\n[![Teligram Chat](https://img.shields.io/badge/telegram-join%20chat-blue.svg)](https://t.me/joinchat/IzEQ3xEXCiRCh8L2q6pTLg)\n\n## :tada: Basic Overview\n\nImage manipulation [\u003cb\u003ego library\u003c/b\u003e](http://godoc.org/github.com/noelyahan/mergi) plus [\u003cb\u003ecross platform CLI tool\u003c/b\u003e](https://github.com/noelyahan/mergi/tree/master/cmd/mergi).\n\n## ⚡ Features\n\n- 🛠 Merge\n- ✂️ Crop\n- 💣 Resize\n- 🖃 Watermark\n- 💖 Animate\n- 🔥 Easing\n- 🦎 Transition\n\n\u003cbr /\u003e\n\n## 🚀 Getting started\n\n### Install via `go get`\n\nTo install Mergi, use `go get`, or download the binary file from [Releases](https://github.com/noelyahan/mergi/releases) page.\n\n```bash\n$ go get github.com/noelyahan/mergi\n```\n\nUsage:\n\n```\n ╔╦╗╔═╗╦═╗╔═╗╦\n ║║║║╣ ╠╦╝║ ╦║\n ╩ ╩╚═╝╩╚═╚═╝╩\n let's go \u0026 make imaging fun\n http://mergi.io\n version 1.0.0\n\n  -a string\n    \tEnter animation type=[sprite, slide] and the delay to get mergi gif animation ex: smooth 10\n  -c value\n    \tEnter crop points and height and width ex: x y w h\n  -f string\n    \tEnter true if you want to process the final output\n  -i value\n    \tEnter images that want to merge ex: /path/img1 or url\n  -o string\n    \tEnter image outputs file ex: out.png or out.jpg (default \"out.png\")\n  -r value\n    \tEnter resize width and height of the output ex: 100 200\n  -t string\n    \tEnter a merge template string ex: TBTBTB (default \"T\")\n  -w value\n    \tEnter watermark image and points to place it, [-r w h] is optional  ex: /path/img -r w h x y\n\n```\n\u003cbr /\u003e\n\n#### 🛠 Merge\n\nImage 1                     | Image 2                               | Result Image\n-----------------------------------|-------------------------------------------|------------------------------------------\n![dstImage](testdata/mergi_bg_1.png)|![srcImage](testdata/mergi_bg_2.png)  | ![dstImage](testdata/doc/merge_tt.png)\n![dstImage](testdata/mergi_bg_1.png)|![srcImage](testdata/mergi_bg_2.png)  | ![dstImage](testdata/doc/merge_tb.png)\n\n##### `Mergi Tool`\n###### Horizontal \n```bash\nmergi \\\n-t TT \\\n-i testdata/mergi_bg_1.png \\\n-i testdata/mergi_bg_2.png\n```\n\n###### Vertical \n```bash\nmergi \\\n-t TB \\\n-i testdata/mergi_bg_1.png \\\n-i testdata/mergi_bg_2.png\n```\n##### `Mergi Library`\n```go\nimage1, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_1.png\"))\nimage2, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_2.png\"))\n\nhorizontalImage, _ := mergi.Merge(\"TT\", []image.Image{image1, image2})\nmergi.Export(impexp.NewFileExporter(horizontalImage, \"horizontal.png\"))\n\nverticalImage, _ := mergi.Merge(\"TB\", []image.Image{image1, image2})\nmergi.Export(impexp.NewFileExporter(verticalImage, \"vertical.png\"))\n```\n\n\n\u003cbr /\u003e\n\n#### ✂️ Crop\nImage                    | Result Image\n-----------------------------------|------------------------------------------\n![srcImage](testdata/mergi_bg_1.png) | ![dstImage](testdata/doc/crop.png)\n\n##### `Mergi Tool`\n```bash\nmergi \\\n-i testdata/mergi_bg_1.png \\\n-c \"10 40 200 110\"\n```\n\n##### `Mergi Library`\n```go\nimg, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_1.png\"))\nres, _ := mergi.Crop(img, image.Pt(10, 40), image.Pt(200, 110))\nmergi.Export(impexp.NewFileExporter(res, \"crop.png\"))\n```\n\n\u003cbr /\u003e\n\n#### 💣 Resize\nImage                    | Result Image\n-----------------------------------|-------------------------------------------\n![srcImage](testdata/mergi_bg_1.png)  | ![dstImage](testdata/doc/resize.png)\n\n##### `Mergi Tool`\n```bash\nmergi \\\n-i testdata/mergi_bg_1.png \\\n-r \"180 80\"\n```\n\n##### `Mergi Library`\n```go\nimg, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_1.png\"))\nres, _ := mergi.Resize(img, uint(180), uint(80))\nmergi.Export(impexp.NewFileExporter(res, \"resize.png\"))\n```\n\n\u003cbr /\u003e\n\n#### 🖃 Watermark\nImage                   | Watermark Image                             | Result Image\n-----------------------------------|-------------------------------------------|------------------------------------------\n![srcImage](testdata/mergi_bg_1.png) | ![dstImage](testdata/mergi_logo_watermark_90x40.png) | ![dstImage](testdata/doc/watermark.png)\n\n##### `Mergi Tool`\n```bash\nmergi \\\n-i testdata/mergi_bg_1.png \\\n-w \"testdata/mergi_logo_watermark_90x40.png 250 10\"\n```\n\n##### `Mergi Library`\n```go\noriginalImage, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_1.png\"))\nwatermarkImage, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/glass-mergi_logo_watermark_90x40.jpg\"))\n\nres, _ := mergi.Watermark(watermarkImage, originalImage, image.Pt(250, 10))\nmergi.Export(impexp.NewFileExporter(res, \"watermark.png\"))\n```\n\n\u003cbr /\u003e\n\n#### 💖 Animate\nImage 1                     | Image 2                               | Result Animation\n-----------------------------------|-------------------------------------------|------------------------------------------\n![srcImage](testdata/mergi_bg_1.png) | ![dstImage](testdata/mergi_bg_2.png) | ![dstImage](testdata/doc/sprite.gif)\n![srcImage](testdata/mergi_bg_1.png) | ![dstImage](testdata/mergi_bg_2.png) | ![dstImage](testdata/doc/smooth.gif)\n\n##### `Mergi Tool`\n###### Sprite Animation \n```bash\nmergi \\\n-t \"TT\" \\\n-i testdata/mergi_bg_1.png \\\n-i testdata/mergi_bg_2.png \\\n-a \"sprite 50\"\n```\n###### Smooth Animation\n```bash\nmergi \\\n-t \"TT\" \\\n-i testdata/mergi_bg_1.png \\\n-i testdata/mergi_bg_2.png \\\n-a \"smooth 5\"\n```\n\n##### `Mergi Library`\n```go\nimage1, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_1.png\"))\nimage2, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/mergi_bg_2.png\"))\n\ngif, _ := mergi.Animate([]image.Image{image1, image2}, 50)\nmergi.Export(impexp.NewAnimationExporter(gif, \"out.gif\"))\n```\n\n\u003cbr /\u003e\n\n#### 🔥 Easing\n\n[]()                   | []() | []() | []()\n-----------------------|----------------------|----------------------|----------------------\n![dstImage](testdata/doc/ease/InBounce.gif)\u003cbr/\u003e\u003ccenter\u003eInBounce\u003c/center\u003e | ![dstImage](testdata/doc/ease/InBack.gif)\u003cbr/\u003e\u003ccenter\u003eInBack\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutQuad.gif)\u003cbr/\u003e\u003ccenter\u003eInOutQuad\u003c/center\u003e | ![dstImage](testdata/doc/ease/InSine.gif)\u003cbr/\u003e\u003ccenter\u003eInSine\u003c/center\u003e\n![dstImage](testdata/doc/ease/InCubic.gif)\u003cbr/\u003e\u003ccenter\u003eInCubic\u003c/center\u003e | ![dstImage](testdata/doc/ease/InElastic.gif)\u003cbr/\u003e\u003ccenter\u003eInElastic\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutExpo.gif)\u003cbr/\u003e\u003ccenter\u003eInOutExpo\u003c/center\u003e | ![dstImage](testdata/doc/ease/Linear.gif)\u003cbr/\u003e\u003ccenter\u003eLinear\u003c/center\u003e\n![dstImage](testdata/doc/ease/InOutBounce.gif)\u003cbr/\u003e\u003ccenter\u003eInOutBounce\u003c/center\u003e | ![dstImage](testdata/doc/ease/InCirc.gif)\u003cbr/\u003e\u003ccenter\u003eInCirc\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutCubic.gif)\u003cbr/\u003e\u003ccenter\u003eInOutCubic\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutQuart.gif)\u003cbr/\u003e\u003ccenter\u003eInOutQuart\u003c/center\u003e\n![dstImage](testdata/doc/ease/InOutBack.gif)\u003cbr/\u003e\u003ccenter\u003eInOutBack\u003c/center\u003e | ![dstImage](testdata/doc/ease/InCubic.gif)\u003cbr/\u003e\u003ccenter\u003eInCubic\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutCirc.gif)\u003cbr/\u003e\u003ccenter\u003eInOutCirc\u003c/center\u003e | ![dstImage](testdata/doc/ease/InOutSine.gif)\u003cbr/\u003e\u003ccenter\u003eInOutSine\u003c/center\u003e\n![dstImage](testdata/doc/ease/InExpo.gif)\u003cbr/\u003e\u003ccenter\u003eInExpo\u003c/center\u003e | ![dstImage](testdata/doc/ease/OutBounce.gif)\u003cbr/\u003e\u003ccenter\u003eOutBounce\u003c/center\u003e | ![dstImage](testdata/doc/ease/InQuint.gif)\u003cbr/\u003e\u003ccenter\u003eInQuint\u003c/center\u003e\n\n##### `Mergi Library`\n\n`Note: Ease function can be applied with any function, in this example it's applied with Watermark function`\n```go\n// Load background and the square images\nsquare, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/square.jpg\"))\nbg, _ := mergi.Import(impexp.NewFileImporter(\"./testdata/white_bg.jpg\"))\n\n// Init images frames to add applied ease frames\nframes := make([]image.Image, 0)\n\n// Init the limts of the Ease\nto := bg.Bounds().Max.X - square.Bounds().Max.X\nposY := bg.Bounds().Max.Y/2 - square.Bounds().Max.Y/2\nspeed := 4\n\n// Ease from 0 to width of background\nfor i := 0; i \u003c to; i += speed {\n  // Apply Easeing function InBounce\n  posX := mergi.Ease(float64(i), 0, float64(to), mergi.InBounce)\n  img, _ := mergi.Watermark(square, bg, image.Pt(int(posX), posY))\n  frames = append(frames, img)\n}\n\n// For preview example, save as a gif\ngif, _ := mergi.Animate(frames, 1)\nmergi.Export(impexp.NewAnimationExporter(gif, \"out.gif\"))\n```\n\n\n\n\n\u003cbr /\u003e\n\n#### 🦎 Transition\n\n[]()                   | []() | []() | []()\n-----------------------|----------------------|----------------------|----------------------\n![dstImage](./testdata/doc/trans/SlideBar.gif)\u003cbr/\u003e\u003ccenter\u003eSlideBar\u003c/center\u003e | ![dstImage](./testdata/doc/trans/Ink1.gif)\u003cbr/\u003e\u003ccenter\u003eInk1\u003c/center\u003e | ![dstImage](./testdata/doc/trans/Ink2.gif)\u003cbr/\u003e\u003ccenter\u003eInk2\u003c/center\u003e | ![dstImage](./testdata/doc/trans/Ink3.gif)\u003cbr/\u003e\u003ccenter\u003eInk3\u003c/center\u003e\n![dstImage](./testdata/doc/trans/ScaleUpFastRect.gif)\u003cbr/\u003e\u003ccenter\u003eScaleUpFastRect\u003c/center\u003e | ![dstImage](./testdata/doc/trans/ScaleDownFastRect.gif)\u003cbr/\u003e\u003ccenter\u003eScaleDownFastRect\u003c/center\u003e | ![dstImage](./testdata/doc/trans/ScaleUpFastCircle.gif)\u003cbr/\u003e\u003ccenter\u003eScaleUpFastCircle\u003c/center\u003e | ![dstImage](./testdata/doc/trans/ScaleDownFastCircle.gif)\u003cbr/\u003e\u003ccenter\u003eScaleDownFastCircle\u003c/center\u003e\n\n\n\nLearn more [examples](examples)\n\n## 💻 Contribute\n\n- Clone the repository\n```bash\n$ go get github.com/noelyahan/mergi\n```\n- Run unit tests\n- Fix bug\n- Add new feature\n- Push\n\n\u003cbr /\u003e\n\n### 🌠 Contributors\n\n  \u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\n| [\u003cimg src=\"https://avatars1.githubusercontent.com/u/6106461?s=460\u0026v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003eNoel\u003c/sub\u003e](https://twitter.com/noelyahan)\u003cbr /\u003e💻 📖 💬 👀 🤔 🎨 |\n| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | \n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\u003cbr/\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.\nContributions of any kind are welcome!\n\n\u003cbr /\u003e\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=noelyahan/mergi\u0026type=Timeline)](https://star-history.com/#noelyahan/mergi\u0026Timeline)\n\n### 🔵 License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoelyahan%2Fmergi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoelyahan%2Fmergi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoelyahan%2Fmergi/lists"}