https://github.com/icemint0828/imgedit
Imgedit is a package that performs image processing such as resizing and trimming.
https://github.com/icemint0828/imgedit
cli file-conversion go golang grayscale image-processing resize reverse tile trim
Last synced: 5 months ago
JSON representation
Imgedit is a package that performs image processing such as resizing and trimming.
- Host: GitHub
- URL: https://github.com/icemint0828/imgedit
- Owner: icemint0828
- License: mit
- Created: 2022-06-16T01:10:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-13T04:23:13.000Z (over 3 years ago)
- Last Synced: 2024-06-21T20:46:19.296Z (almost 2 years ago)
- Topics: cli, file-conversion, go, golang, grayscale, image-processing, resize, reverse, tile, trim
- Language: Go
- Homepage:
- Size: 8.24 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README

[](https://badge.fury.io/go/github.com%2Ficemint0828%2Fimgedit)
[](https://github.com/icemint0828/imgedit/actions/workflows/go.yml)
[](https://goreportcard.com/report/github.com/icemint0828/imgedit)
[](https://codecov.io/gh/icemint0828/imgedit)
[](https://www.codefactor.io/repository/github/icemint0828/imgedit)
[](https://golangexample.com/imgedit-a-package-that-performs-image-processing-such-as-resizing-and-trimming)
[](https://opensource.org/licenses/MIT)
## Overview
`Imgedit` is a package that performs image processing such as resizing and trimming available on both CLI and [GUI](#usage-gui).
## Features
- resize
- trim
- tile (lay down images)
- reverse (`vertical`, `horizon`)
- ~~grayscale~~
- add string
- filter (`gray`, `sepia`)
- interactive file format conversion (`png`, `jpeg`, `gif`)
resize
trim
tile
reverse horizon
reverse vertical
add string
filter gray
filter sepia
## Usage (Package)
```shell
$ go get github.com/icemint0828/imgedit@v1.6.0
```
An example with file conversion is as follows.
```go
package main
import (
"github.com/icemint0828/imgedit"
)
func main() {
fc, _, err := imgedit.NewFileConverter("srcImage.png")
if err != nil {
panic(err)
}
fc.Filter(imgedit.GrayModel)
err = fc.SaveAs("dstImage.png", imgedit.Png)
if err != nil {
panic(err)
}
}
```
It can also work with just convert bytes through io.Writer and io.Reader.
```go
package main
import (
"bytes"
"os"
"github.com/icemint0828/imgedit"
)
func main() {
srcFile, err := os.Open("srcImage.png")
if err != nil {
panic(err)
}
defer srcFile.Close()
bc, _, err := imgedit.NewByteConverter(srcFile)
bc.ResizeRatio(0.5)
buffer := bytes.NewBuffer([]byte{})
_ = bc.WriteAs(buffer, imgedit.Jpeg)
dstFile, err := os.Create("dstImage.png")
if err != nil {
panic(err)
}
defer dstFile.Close()
_, _ = buffer.WriteTo(dstFile)
}
```
It can also work with just convert image.
```go
package main
import (
"image/png"
"os"
"github.com/icemint0828/imgedit"
)
func main() {
srcFile, err := os.Open("srcImage.png")
if err != nil {
panic(err)
}
defer srcFile.Close()
srcImage, err := png.Decode(srcFile)
if err != nil {
panic(err)
}
c := imgedit.NewConverter(srcImage)
c.Resize(500, 500)
dstImage := c.Convert()
dstFile, err := os.Create("dstImage.png")
if err != nil {
panic(err)
}
defer dstFile.Close()
err = png.Encode(dstFile, dstImage)
if err != nil {
panic(err)
}
}
```
## Usage (CLI)
You can download the executable file from the link below.
- ### [Windows](https://github.com/icemint0828/imgedit/releases/latest/download/imgedit_Windows.zip)
- ### [Linux](https://github.com/icemint0828/imgedit/releases/latest/download/imgedit_Linux.zip)
- ### [mac OS](https://github.com/icemint0828/imgedit/releases/latest/download/imgedit_MacOS.zip)
Or if you can use `brew` on mac OS.
```shell
$ brew install icemint0828/tap/imgedit
```
For more information, please use the help command:
```shell
$ imgedit -help
```
## Usage (CLI on docker)
You can also run the CLI on docker.
This procedure can only convert files under the current working directory(WD).
```shell
$ docker run --rm -e WD=$(pwd) -v $(pwd):/mnt ghcr.io/icemint0828/imgedit:latest filter srcImage.png -mode gray
```
For more information, please use the help command:
```shell
$ docker run --rm -e WD=$(pwd) -v $(pwd):/mnt ghcr.io/icemint0828/imgedit:latest -help
```
## Usage (GUI)
You can also use a [sample GUI tool](https://github.com/icemint0828/imgedit-wasm) that is created with `WASM` by this package.
- ### Check out the [image edit tool](https://icemint0828.github.io/imgedit-wasm/)
## Contributing
This project is currently at early stages and is being developed by internal members.
- Report your issues through [GitHub issues](https://github.com/icemint0828/imgedit/issues).
## License
`imgedit` is under [MIT license](https://github.com/icemint0828/imgedit/blob/main/LICENSE).