1.1.0 • Published 11 months ago

intelli-image-crop v1.1.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
11 months ago

intelli-image-crop

Intelli Image Crop intelligently removes white spaces from raster images. For Javascript and Typescript users.

npm version



Usage

  1. Import the module...
const removeImageBlanks = require('intelli-image-crop'); // Legacy Javascript
import removeImageBlanks from 'intelli-image-crop'; // Modern Javascript (React)
  1. Usage example...
const imageObject = ...; // Your image object
const padding = 10; // Padding value
const cornerRadius = 20; // Corner radius value

const result = removeImageBlanks(imageObject, padding, cornerRadius);
  1. Make sure the imageObject is rasterized (in pixels, not vectors) before you begin...
// Rasterize the canvas
const rasterizedCanvas = document.createElement("canvas");

rasterizedCanvas.width = viewerCanvas.offsetWidth;
rasterizedCanvas.height = viewerCanvas.offsetHeight;

const rasterizedContext = rasterizedCanvas.getContext("2d");

rasterizedContext.drawImage(viewerCanvas, 0, 0);
1.1.0

11 months ago

1.0.0

11 months ago