Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hachiya-kurisu/aspeq
match closest "standard" aspect ratio from an image, or from width and height
https://github.com/hachiya-kurisu/aspeq
aspect-ratio go golang
Last synced: 10 days ago
JSON representation
match closest "standard" aspect ratio from an image, or from width and height
- Host: GitHub
- URL: https://github.com/hachiya-kurisu/aspeq
- Owner: hachiya-kurisu
- License: bsd-2-clause
- Created: 2024-12-10T17:09:00.000Z (30 days ago)
- Default Branch: main
- Last Pushed: 2024-12-21T05:28:28.000Z (19 days ago)
- Last Synced: 2024-12-21T06:24:10.997Z (19 days ago)
- Topics: aspect-ratio, go, golang
- Language: Go
- Homepage: https://blekksprut.net/aspeq/
- Size: 37.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.gmi
- License: LICENSE
Awesome Lists containing this project
README
# aspeq
aspeq finds the closest "standard" aspect ratio from an image file, or from relative or absolute dimensions (width and height)
## defined ratios
* tiktok (9:16)
* instax (3:4)
* square (1:1)
* movietone (1.19:1)
* four-thirds (4:3)
* academy (1.375:1)
* leica (3:2)
* super16 (5:3)
* sixteen-nine (16:9)
* flat (1.85:1)
* univisium (2:1)
* cinemascope (2.35:1)
* cinerama (2.59:1)
* widelux (3:1)
* polyvision (4:1)
* circle-vision (12:1)## command line
```sh
% aspeq *.jpeg
1.66.jpeg: super16
1.77.jpeg: sixteen-nine
2.35.jpeg: cinemascope% aspeq -x 1.66.jpeg
1.66.jpeg: 5:3
```## go
```go
package mainimport (
"fmt"
"blekksprut.net/aspeq"
)func main() {
ratio := aspeq.Match(320, 240)
fmt.Println(ratio.Xy()) // prints "4:3"ar, err := aspeq.FromImage("1.66.jpeg") // a 40:24 image
if err != nil {
panic(err)
}
fmt.Println(ar.Name) // prints "super16"
}
```