JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q30626F
  • License ISC

Simple Trimming

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