SVD image compression
An implementation image compression using SVD decomposition on Go
Built With
Compression examples
Compress ratio |
Image |
Original |
|
Ratio 10% |
|
Ratio 50% |
|
Ratio 80% |
|
Ratio 90% |
|
Ratio 99% |
|
Getting Started
To get a local copy up and running follow these simple steps.
Installation
Install vendor
go get -u github.com/nurlantulemisov/imagecompression
Simple usage
package main
import (
compression "github.com/nurlantulemisov/imagecompression"
"image/png"
"log"
"os"
)
func main() {
file, err := os.Open("examples/simple_usage/tmp/test.png")
if err != nil {
log.Fatalf(err.Error())
}
img, err := png.Decode(file)
if err != nil {
log.Fatalf(err.Error())
}
compressing, _ := compression.New(95)
compressingImage := compressing.Compress(img)
f, err := os.Create("examples/simple_usage/tmp/compressed-test.png")
if err != nil {
log.Fatalf("error creating file: %s", err)
}
defer func(f *os.File) {
err := f.Close()
if err != nil {
log.Fatalf(err.Error())
}
}(f)
err = png.Encode(f, compressingImage)
if err != nil {
log.Fatalf(err.Error())
}
}
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any
contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
Roadmap
- Compression of grayscale images
- Provide Frobenius norm
Tulemisov Nurlan - @NurlanTulemisov
Email - nurlan.tulemisov@gmail.com
Project Link: https://github.com/nurlantulemisov/imagecompression