1.0.9 • Published 2 months ago

cropify v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

NPM Version NPM Downloads NPM License GitHub Repo stars

Features

  • Crop images with precision using the Canvas API.
  • Optional support for rounding corners with a customizable border radius.
  • Designed for simplicity and performance.
  • Upscale and cover image.

Installation

npm install cropify

Usage

import { cropImage } from "cropify";
import fs from "fs";

// OR

const { cropImage } = require("cropify");
const fs = require("fs");

const image = 'https://th.bing.com/th/id/OIGP.914kwCtAqWQ7Lkx5hT2B?pid=ImgGn';

const cropX = 0;
const cropY = 0;
const cropWidth = 1280;
const cropHeight = 720;
const borderRadius = 80;

cropImage({
    imagePath: image,
    x: cropX,
    y: cropY,
    width: cropWidth,
    height: cropHeight,
    borderRadius: borderRadius,
    cropCenter: true
}).then(x => {
    console.log("Image has been cropped.")
    fs.writeFileSync("cropped-image.png", x);
});

Output

example

Licence

MIT

1.0.9

2 months ago

1.0.9-beta.1

2 months ago

1.0.9-beta.0

2 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

4 months ago

1.0.0

4 months ago

1.0.0-beta.1

4 months ago