Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/echosoar/imgpro
Imgpro is a multifunctional image information recognition library, supporting a variety of image formats. And it can be run in the browser through WebAssembly(wasm).
https://github.com/echosoar/imgpro
bmp-decoder gif-decoder go-qrcode golang image image-decoder image-recognition jpg-decoder js-image no-dependencies png png-decoder pure-golang qrcode-decoder webassembly webp webp-decoder
Last synced: 2 months ago
JSON representation
Imgpro is a multifunctional image information recognition library, supporting a variety of image formats. And it can be run in the browser through WebAssembly(wasm).
- Host: GitHub
- URL: https://github.com/echosoar/imgpro
- Owner: echosoar
- License: mit
- Created: 2021-01-27T13:17:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-03T16:01:47.000Z (over 2 years ago)
- Last Synced: 2024-06-20T22:34:15.400Z (6 months ago)
- Topics: bmp-decoder, gif-decoder, go-qrcode, golang, image, image-decoder, image-recognition, jpg-decoder, js-image, no-dependencies, png, png-decoder, pure-golang, qrcode-decoder, webassembly, webp, webp-decoder
- Language: Go
- Homepage:
- Size: 14.1 MB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Imgpro
[![CircleCI](https://circleci.com/gh/echosoar/imgpro/tree/main.svg?style=svg&circle-token=355449f4d49bf63a561c68c57221688dadc48691)]((https://circleci.com/gh/echosoar/imgpro/tree/main))
Imgpro is a multifunctional image information recognition library, supporting a variety of image formats. And it can be run in the browser through WebAssembly(wasm).
Online Demo: [imgpro](https://echosoar.github.io/imgpro/)
### Usage
#### Initial
```shell
$ go get github.com/echosoar/imgpro
```
#### Use in code
```go
import (
"github.com/echosoar/imgpro"
)func main() {
// run by file path
result := imgpro.Run("./test/imgs/go.png", []string{"size", "type"})
// you can also run by file binary data
// result := imgpro.RunBinary(binary, attributes)
if result["size"].Int != 60746 {
panic("size error")
}
if result["type"].String != "png" {
panic("type error")
}
}
```### Method
#### Run> Get image information by local file path
|Param Index|Param Name|Type|Examples|
| --- | --- | --- |--- |
| 0 | filePath | string | "./test/imgs/go.png" |
| 1 | attributes | []string | []string{"size", "type", "rgba", "hue", "qrcode"} |```go
import (
"github.com/echosoar/imgpro"
)func main() {
result := imgpro.Run("./test/imgs/go.png", []string{"size", "type", "rgba", "hue", "qrcode"})
}
```#### RunBinary
> Get image information by file binary data|Param Index|Param Name|Type|Examples|
| --- | --- | --- |--- |
| 0 | fileBinary | []byte | reader.Read(binary) |
| 1 | attributes | []string | []string{"size", "type", "rgba", "hue", "qrcode"} |```go
import (
"bufio"
"os""github.com/echosoar/imgpro"
)func main() {
fileHandler, err := os.Open(filePath)
if err != nil {
panic("open error")
}
defer fileHandler.Close()
fileBytes := make([]byte, size)
reader := bufio.NewReader(fileHandler)
_, readErr := reader.Read(fileBytes)
if readErr != nil {
panic("file read error")
}
result := imgpro.RunBinary(fileBytes, []string{"size", "type", "rgba", "hue", "qrcode"})
}
```### Features
| Features | Attribute | PNG | JPG | GIF | BMP | WebP | HEIC | AVIF |
| --- | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| File Size | size | ✅ | ✅ | ✅ | ✅ | ✅ |||
| Format Detect | type | ✅ | ✅ | ✅ | ✅ | ✅ |||
| Width/Height| wh | ✅ | ✅ | ✅ | ✅ | ✅ ||
| Frames | frame | ✅ | ✅ | ✅ |
| Color data | rgba | ✅ | ✅ | ✅ |
| Color proportion | hue | ✅ | ✅ | ✅ |
| QR Code | qrcode | ✅ | ✅| ✅ | | |
| Exif | exif | | ✅ |
| Create Time | time | |✅ | | | |
| Position(GPS) Info | position | |✅ | | | |
| Device Info | device | | ✅| | | |---
© MIT by echosoar