Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkristof200/jimproundedcorners
https://github.com/kkristof200/jimproundedcorners
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kkristof200/jimproundedcorners
- Owner: kkristof200
- License: mit
- Created: 2020-09-20T12:28:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T09:34:37.000Z (about 4 years ago)
- Last Synced: 2024-10-06T21:18:03.603Z (about 1 month ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jimp-roundedcorners
Rounds the corners of a Jimp image.
## Install
```bash
npm i jimp-roundedcorners
```## Usage
```typescript
import Jimp from 'jimp'
import { roundCornersFromPath, roundCorners } from 'jimp-roundcorners'roundCornersFromPath('inPath', {
outImgPath: 'outPath',
cornerRadius: {
topLeft: 25,
topRight: 25,
// bottomRight: 25,
bottomLeft: 25,
// If any of the above is not provided,
// 'global' will be used instead
// In this case 'bottomRight'.
// If global is not prvided, the default value is
// Math.min(img.bitmap.width, img.bitmap.height) / 10
global: 50
}
})
.then(res => { console.log(res.img, res.path) })
.catch(err => console.log(err))Jimp.read('inPath')
.then(img => {
roundCorners(img, {
cornerRadius: {
topLeft: 25,
topRight: 25,
// bottomRight: 25,
bottomLeft: 25,
// If any of the above is not provided, 'global' will be used instead
// In this case 'bottomRight'.
// If global is not prvided, the default value is
// Math.min(img.bitmap.width, img.bitmap.height) / 10
global: 50
}
}).write('outPath')
})
.catch(err => console.log(err))
```