https://github.com/stevenferrer/image-cropping
A demo of server-side image cropping with Go and cropper.js.
https://github.com/stevenferrer/image-cropping
cropperjs cropping go golang
Last synced: 5 months ago
JSON representation
A demo of server-side image cropping with Go and cropper.js.
- Host: GitHub
- URL: https://github.com/stevenferrer/image-cropping
- Owner: stevenferrer
- License: mit
- Created: 2021-01-28T12:02:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-04T03:00:40.000Z (about 4 years ago)
- Last Synced: 2025-07-25T18:33:23.017Z (6 months ago)
- Topics: cropperjs, cropping, go, golang
- Language: Vue
- Homepage:
- Size: 772 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image cropping
A demo of server-side image cropping with [Go](https://golang.org/) and [cropper.js](https://github.com/fengyuanchen/cropperjs).
## How it works?
In this demo, we're using [cropper.js](https://github.com/fengyuanchen/cropperjs) to crop the image in the browser and send the crop details to the server to process the final result.
### Why do the crop work on server?
[Cropper.js](https://github.com/fengyuanchen/cropperjs) uses the browser's native [canvas.toBlob API](https://github.com/fengyuanchen/cropperjs/issues/534) which means, it will produce a reduced quality image. To mend this, we do the crop work on the server.
## Running
1. Install web app dependencies.
```console
$ yarn // or npm install
```
2. Build the web app.
```console
$ yarn build // or npm run build
```
3. Run the server.
```console
$ go run main.go
```
4. Go to [localhost:3002](http://localhost:3002) and start playing!