![Mergi](https://github.com/panorigin/others_mergi/raw/HEAD/./logo/logo.png)
Result | Terminal Code |
---|
![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" |
![Teligram Chat](https://img.shields.io/badge/telegram-join%20chat-blue.svg)
:tada: Basic Overview
Image manipulation go library plus cross platform CLI tool.
⚡ Features
- 🛠 Merge
- ✂️ Crop
- 💣 Resize
- 🖃 Watermark
- 💖 Animate
- 🔥 Easing
- 🦎 Transition
🚀 Getting started
Install via go get
To install Mergi, use go get
, or download the binary file from Releases page.
$ go get github.com/noelyahan/mergi
Usage:
╔╦╗╔═╗╦═╗╔═╗╦
║║║║╣ ╠╦╝║ ╦║
╩ ╩╚═╝╩╚═╚═╝╩
let's go & make imaging fun
http://mergi.io
version 1.0.0
-a string
Enter animation type=[sprite, slide] and the delay to get mergi gif animation ex: smooth 10
-c value
Enter crop points and height and width ex: x y w h
-f string
Enter true if you want to process the final output
-i value
Enter images that want to merge ex: /path/img1 or url
-o string
Enter image outputs file ex: out.png or out.jpg (default "out.png")
-r value
Enter resize width and height of the output ex: 100 200
-t string
Enter a merge template string ex: TBTBTB (default "T")
-w value
Enter watermark image and points to place it, [-r w h] is optional ex: /path/img -r w h x y
🛠 Merge
Image 1 | Image 2 | Result Image |
---|
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_2.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/merge_tt.png) |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_2.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/merge_tb.png) |
Mergi Tool
Horizontal
mergi \
-t TT \
-i testdata/mergi_bg_1.png \
-i testdata/mergi_bg_2.png
Vertical
mergi \
-t TB \
-i testdata/mergi_bg_1.png \
-i testdata/mergi_bg_2.png
Mergi Library
image1, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_1.png"))
image2, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_2.png"))
horizontalImage, _ := mergi.Merge("TT", []image.Image{image1, image2})
mergi.Export(impexp.NewFileExporter(horizontalImage, "horizontal.png"))
verticalImage, _ := mergi.Merge("TB", []image.Image{image1, image2})
mergi.Export(impexp.NewFileExporter(verticalImage, "vertical.png"))
✂️ Crop
Image | Result Image |
---|
![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/crop.png) |
Mergi Tool
mergi \
-i testdata/mergi_bg_1.png \
-c "10 40 200 110"
Mergi Library
img, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_1.png"))
res, _ := mergi.Crop(img, image.Pt(10, 40), image.Pt(200, 110))
mergi.Export(impexp.NewFileExporter(res, "crop.png"))
💣 Resize
Image | Result Image |
---|
![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/resize.png) |
Mergi Tool
mergi \
-i testdata/mergi_bg_1.png \
-r "180 80"
Mergi Library
img, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_1.png"))
res, _ := mergi.Resize(img, uint(180), uint(80))
mergi.Export(impexp.NewFileExporter(res, "resize.png"))
🖃 Watermark
Image | Watermark Image | Result Image |
---|
![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_logo_watermark_90x40.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/watermark.png) |
Mergi Tool
mergi \
-i testdata/mergi_bg_1.png \
-w "testdata/mergi_logo_watermark_90x40.png 250 10"
Mergi Library
originalImage, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_1.png"))
watermarkImage, _ := mergi.Import(impexp.NewFileImporter("./testdata/glass-mergi_logo_watermark_90x40.jpg"))
res, _ := mergi.Watermark(watermarkImage, originalImage, image.Pt(250, 10))
mergi.Export(impexp.NewFileExporter(res, "watermark.png"))
💖 Animate
Image 1 | Image 2 | Result Animation |
---|
![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_2.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/sprite.gif) |
![srcImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_1.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/mergi_bg_2.png) | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/smooth.gif) |
Mergi Tool
Sprite Animation
mergi \
-t "TT" \
-i testdata/mergi_bg_1.png \
-i testdata/mergi_bg_2.png \
-a "sprite 50"
Smooth Animation
mergi \
-t "TT" \
-i testdata/mergi_bg_1.png \
-i testdata/mergi_bg_2.png \
-a "smooth 5"
Mergi Library
image1, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_1.png"))
image2, _ := mergi.Import(impexp.NewFileImporter("./testdata/mergi_bg_2.png"))
gif, _ := mergi.Animate([]image.Image{image1, image2}, 50)
mergi.Export(impexp.NewAnimationExporter(gif, "out.gif"))
🔥 Easing
| | | |
---|
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InBounce.gif) InBounce | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InBack.gif) InBack | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutQuad.gif) InOutQuad | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InSine.gif) InSine |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InCubic.gif) InCubic | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InElastic.gif) InElastic | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutExpo.gif) InOutExpo | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/Linear.gif) Linear |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutBounce.gif) InOutBounce | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InCirc.gif) InCirc | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutCubic.gif) InOutCubic | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutQuart.gif) InOutQuart |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutBack.gif) InOutBack | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InCubic.gif) InCubic | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutCirc.gif) InOutCirc | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InOutSine.gif) InOutSine |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InExpo.gif) InExpo | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/OutBounce.gif) OutBounce | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/testdata/doc/ease/InQuint.gif) InQuint | |
Mergi Library
Note: Ease function can be applied with any function, in this example it's applied with Watermark function
square, _ := mergi.Import(impexp.NewFileImporter("./testdata/square.jpg"))
bg, _ := mergi.Import(impexp.NewFileImporter("./testdata/white_bg.jpg"))
frames := make([]image.Image, 0)
to := bg.Bounds().Max.X - square.Bounds().Max.X
posY := bg.Bounds().Max.Y/2 - square.Bounds().Max.Y/2
speed := 4
for i := 0; i < to; i += speed {
posX := mergi.Ease(float64(i), 0, float64(to), mergi.InBounce)
img, _ := mergi.Watermark(square, bg, image.Pt(int(posX), posY))
frames = append(frames, img)
}
gif, _ := mergi.Animate(frames, 1)
mergi.Export(impexp.NewAnimationExporter(gif, "out.gif"))
🦎 Transition
| | | |
---|
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/SlideBar.gif) SlideBar | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/Ink1.gif) Ink1 | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/Ink2.gif) Ink2 | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/Ink3.gif) Ink3 |
![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/ScaleUpFastRect.gif) ScaleUpFastRect | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/ScaleDownFastRect.gif) ScaleDownFastRect | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/ScaleUpFastCircle.gif) ScaleUpFastCircle | ![dstImage](https://github.com/panorigin/others_mergi/raw/HEAD/./testdata/doc/trans/ScaleDownFastCircle.gif) ScaleDownFastCircle |
Learn more examples
💻 Contribute
$ go get github.com/noelyahan/mergi
- Run unit tests
- Fix bug
- Add new feature
- Push
🌠 Contributors
This project follows the all-contributors specification.
Contributions of any kind are welcome!
🔵 License
This project is licensed under the MIT License - see the LICENSE.md file for details