Imaging 4 terminal lovers (merge, crop, resize, watermark, animate)
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8fe33fe Sep 27, 2018

README.md

Mergi

Result Terminal Code
Intro 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"

Go Doc Build Status codecov Go Report Card Teligram Chat

πŸŽ‰ Basic Overview

Image manipulation go library plus cross platform CLI tool.

⚑ Features

  • πŸ›  Merge
  • βœ‚οΈ Crop
  • πŸ’£ Resize
  • πŸ–ƒ Watermark
  • πŸ’– Animate

πŸš€ 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 srcImage dstImage
dstImage srcImage dstImage
Mergi Tool
Horizontal
mergi \
-t TT \
-i testdata/glass-3306625_240_160.jpg \
-i testdata/glass-3306662_240_160.jpg
Vertical
mergi \
-t TB \
-i testdata/glass-3306625_240_160.jpg \
-i testdata/glass-3306662_240_160.jpg
Mergi Library
image1, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306625_240_160.jpg"))
image2, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306662_240_160.jpg"))

horizontalImage, _ := mergi.Merge("TT", []image.Image{image1, image2})
mergi.Export(loader.NewFileExporter(horizontalImage, "horizontal.png"))

verticalImage, _ := mergi.Merge("TB", []image.Image{image1, image2})
mergi.Export(loader.NewFileExporter(verticalImage, "vertical.png"))

βœ‚οΈ Crop

Image Result Image
srcImage dstImage
Mergi Tool
mergi \
-i testdata/glass-3306662_240_160.jpg \
-c "0 0 120 160"
Mergi Library
img, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306662_240_160.jpg"))
res, _ := mergi.Crop(img, image.Pt(0, 0), image.Pt(120, 160))
mergi.Export(loader.NewFileExporter(res, "crop.png"))

πŸ’£ Resize

Image Result Image
srcImage dstImage
Mergi Tool
mergi \
-i testdata/glass-3306662_240_160.jpg \
-r "80 120"
Mergi Library
img, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306662_240_160.jpg"))
res, _ := mergi.Resize(img, uint(80), uint(120))
mergi.Export(loader.NewFileExporter(res, "resize.png"))

πŸ–ƒ Watermark

Image Watermark Image Result Image
srcImage dstImage dstImage
Mergi Tool
mergi \
-i testdata/glass-3306662_240_160.jpg \
-w "testdata/mergi_logo_watermark_90x40.png 20 60"
Mergi Library
originalImage, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306662_240_160.jpg"))
watermarkImage, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-mergi_logo_watermark_90x40.jpg"))

res, _ := mergi.Watermark(watermarkImage, originalImage, image.Pt(20, 60))
mergi.Export(loader.NewFileExporter(res, "watermark.png"))

πŸ’– Animate

Image 1 Image 2 Result Animation
srcImage dstImage dstImage
srcImage dstImage dstImage
Mergi Tool
Sprite Animation
mergi \
-t "TT" \
-i testdata/glass-3306625_240_160.jpg \
-i testdata/glass-3306662_240_160.jpg \
-a "sprite 50"
Smooth Animation
mergi \
-t "TT" \
-i testdata/glass-3306625_240_160.jpg \
-i testdata/glass-3306662_240_160.jpg \
-a "smooth 5"
Mergi Library
image1, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306625_240_160.jpg"))
image2, _ := mergi.Import(loader.NewFileImporter("./testdata/glass-3306662_240_160.jpg"))

gif, _ := mergi.Animate([]image.Image{image1, image2}, 50)
mergi.Export(loader.NewAnimationExporter(gif, "out.gif"))

Learn more examples

πŸ’» Contribute

  • Clone the repository
$ go get github.com/noelyahan/mergi
  • Run unit tests
  • Fix bug
  • Add new feature
  • Push

🌠 Contributors


Noel

πŸ’» πŸ“– πŸ’¬ πŸ‘€ πŸ€” 🎨

This project follows the [all-contributors](https://github.com/kentcdodds/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