Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simprim) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SimPrim
SimPrim is a simple JavaScript library for trimming images into square shapes only.
๐ฆ How to Include SimPrim
Use a <script> tag to include the library:
<!-- Uncompressed -->
<script src="https://cdn.nfolio.one/simprim-1.1.1.js" integrity="sha256-UQW9kRf2EP6GXuUHEYAMXhE7ETtpldY5VMxCvDtracA=" crossorigin="anonymous"></script>
<!-- Minified -->
<script src="https://cdn.nfolio.one/simprim-1.1.1.min.js" integrity="sha256-ni+TU+scHZJDIo2wAlaKlWWl7mHV5maL1oI/tX1oEN8=" crossorigin="anonymous"></script>๐ Usage
Create a new SimPrim instance by passing an input object:
const simprim = new SimPrim(input);๐งพ Input Object Properties
| Property | Type | Required | Description | 
|---|---|---|---|
| img | Image | โ | The image to be trimmed | 
| inputCvs | Canvas | โ | Canvas used to edit the image | 
| exportCvs | Canvas | โ | Canvas used to draw the trimmed image | 
| inputCvsWidth | number | Optional | Width of the input canvas (used when height > width) | 
| inputCvsHeight | number | Optional | Height of the input canvas (used when height > width) | 
| previewCvs | Canvas | Optional | Canvas used for preview display | 
| trimmingPath | string | Optional | URL of trimming mask image (default: https://cdn.nfolio.one/trimming.png) | 
๐ Available Methods
simprim.init(img, inputCvsWidth, inputCvsHeight, trimmingPath);
simprim.dragDetection(previewCvs);
simprim.sizeChange();
simprim.exportImg(exportCvs);๐ Notes
- SimPrim only supports square trimming.
- Sample page : https://nfolio567.github.io/SimPrim-example/