npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@trandx/crop-image

v1.0.6

Published

## Mentions [![Start](https://img.shields.io/github/stars/Trandx/crop-image?style=flat-square)](https://github.com/Trandx/crop-image) [![Total Downloads](https://img.shields.io/github/downloads/trandx/crop-image/total)](https://www.npmjs.com/package/@tran

Downloads

3

Readme

Crop-image

Mentions

Start Total Downloads Known Vulnerabilities Open Source Love MIT Licence

NPM Package

Capture

crop image capture

Description

Crop-image is a simple package that will help you to capture a particular part of your image. this package is good if you want to manage certain part and resize a user profil. This package is lite. it has zero-dependency and has wittren in TypeScript.

Quick examples

   <div id="app" class="flex justify-center space-x-1">
      <div class=" border-2 border-primary relative h-512 w-512"  >
        <img src="man-8293794_1280.webp" class="bg-gray-800 w-full h-full opacity-70" alt="" srcset="">
        <div id="cropElt" class=" border-primary absolute top-5 h-256 w-256  border-2" draggable="true">
            <canvas  class="rounded-full border-primary border-2" ></canvas>
            <!-- <div class="dot rotate" id="rotate"></div>
            <div class="rotate-link bg-[#1E88E5] hover:bg-[#0D47A1]"></div> -->
            <div class=" resizer top-left" ></div>
            <div class=" resizer bottom-left" ></div>
            <div class=" resizer  mid-top" ></div>
            <div class=" resizer mid-bottom" ></div>
            <div class=" resizer mid-left" ></div>
            <div class=" resizer mid-right" ></div>
            <div class=" resizer bottom-right" ></div>
            <div class=" resizer top-right" ></div>

            <div class=" w-full border-2 border-primary absolute border-dotted top-50"></div>
            <div class=" h-full border-2 border-primary absolute border-dotted top-0 left"></div>
        </div>
      </div>
      <div class="w-512 h-512 border-2 border-primary">
        <img src="man-8293794_1280.webp" srcset="" id="imgCropped" class="w-full h-full"/>
      </div>
    </div>
  import { CropImage } from '@trandx/crop-image';
    
      const cropElt = document.querySelector('#cropElt')
      const imageSrc = "man-8293794_1280.webp"
      const imgCropped = document.querySelector("#imgCropped")
      const corner_class = {
        top_left: "top-left",
        mid_top: "mid-top",
        top_right: "top-right",
        mid_left: "mid-left",
        mid_right: "mid-right",
        bottom_left: "bottom-left",
        mid_bottom: "mid-bottom",
        bottom_right: "bottom-right",
      }

      const cropImage = new CropImage()
   
      cropImage.run({crop_elt: cropElt, img_src: imageSrc, corner_class})?.oncrop((e)=>{
        /**
          * to get data, you can use the const cropImage or event e 
          * 
          * eg 1 :
          * 
          * // const crop = e.currentTarget as CropImage
          * // console.log(crop.getImageCropped());
          * 
          * eg 2:
          * 
          * //cropImage.download();
          * //imageCropped.value.src = cropImage.getImageCropped()
          * 
          */
        const crop = e.currentTarget
        const data = crop.getImageCropped("webp")
        imgCropped.srcset = data
        console.log(data);
      })
    
CHECK CSS CODE IN THE PACKAGE

Running online code link

For running code you can check here

NOTE: The default attribut Class that you see in this prevevious JS example can be updated but, it must be declared in the HTML Code for a well running

Running

Install via package manager

npm i @trandx/crop-image or pnpm i @trandx/crop-image

To run benchmark on your PC follow steps from below

  1. git clone https://github.com/Trandx/crop-image.git
  2. cd into the directory
  3. pnpm install
  4. pnpm dev

In case you notice any irregularities in benchmark or you want to add sort library to benchmark score please open issue here

Author

alt text