https://github.com/afeiship/go-tinypng
Tinypng sdk for golang.
https://github.com/afeiship/go-tinypng
api-key compress file go-tinypng golang image imagemin sdk tinypng
Last synced: 3 months ago
JSON representation
Tinypng sdk for golang.
- Host: GitHub
- URL: https://github.com/afeiship/go-tinypng
- Owner: afeiship
- Created: 2020-01-05T12:35:56.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-12-13T15:02:03.000Z (4 months ago)
- Last Synced: 2026-01-19T17:11:49.831Z (3 months ago)
- Topics: api-key, compress, file, go-tinypng, golang, image, imagemin, sdk, tinypng
- Language: Go
- Homepage:
- Size: 89.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-tinypng
> Tinypng sdk for golang.
## installation
```sh
go get -u github.com/afeiship/go-tinypng
```
## usage
```go
package main
import (
"fmt"
"log"
"os"
"github.com/afeiship/go-tinypng"
)
var apiKey = os.Getenv("TINYPNG_API_KEY")
var client = tinypng.New(apiKey)
func main() {
// compress image from file
result1, err := client.CompressFromFile("image.png")
if err != nil {
log.Fatal(err)
}
fmt.Println(result1)
// compress image from url
result2, err := client.CompressFromURL("https://example.com/image.png")
if err != nil {
log.Fatal(err)
}
fmt.Println(result2)
}
```
## resources
- https://tinypng.com/developers/reference