A Golang backend service with HTTP routes for image processing. The service provide the following functionalities:
- Convert image files from PNG to JPEG.
- Resize images according to specified dimensions.
- Compress images to reduce file size while maintaining reasonable quality.
git clone https://github.com/abdiltegar/image-processing
The GoCV package provides Go language bindings for the OpenCV 4 computer vision library. To install GoCV, you can follow this instructions.
Note: If you use windows, some steps might be different :
- Just after installing MinGW-W64 and CMake, restart your device before execute
win_build_opencv.cmd
- If you don't have
src
folder under yourGOPATH
, createsrc
folder and copy foldergocv.io
and paste it insrc
. Open the foldersrc/gocv.io/x/
rename foldergocv@v~
togocv
Refferences :
go mod tidy
Copy .env.example
file and rename it to .env
. Open it and set the SERVER_HOST
and SERVER_PORT
.
To run the program, go to project directory and you can simply run this command
go run main.go
Documentation about how to use this service can be seen at
{{your_host}}/swagger/index.html
after running the program. Or if you want to use Postman documentation instead of Swagger, you can go to this link.
To test and see the coverage :
- Execute test and save the coverage to
c.out
go test -v ./... -coverprofile="c.out"
- Show coverage
go tool cover -html="c.out"