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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tuhu/imgcut

v1.0.8

Published

imgcut for tuhu arch

Downloads

10

Readme

图片剪裁

原始图片链接在前端展示需经过处理后,再使用。可以通过该组件进行图片压缩,剪裁等。

可处理的图片类型

img[1-4].tuhu.org/xxx

安装

npm install @tuhu/imgcut

eg.

var imgCut = require('@tuhu/imgcut');
imgCut.getSrc({
  width: '10%',
  src: 'https://img1.tuhu.org/activity/image/d66a/13a3/949ff9d23d4c39b8c4100b07_w1080_h819.png'
})

参数说明

参数|类型|说明 :-:|:-:|:-: wdth|String|说明1 src|String|说明2

  • width: 单位(['rem', 'px', '%', 'vw'])
  • 负数或者falsy,抛出异常
  • 大于原始值并且图片带宽高比:剪裁结果取原始值

src说明2:

  1. 可处理类型:
  • 标准url: https://img1.tuhu.org/activity/image/0139/5618/3d16866d2fb2d2059d550f29_w158_h158.png
  • url长宽格式不同: https://img1.tuhu.org/activity/image/0139/5618/3d16866d2fb2d2059d550f29_158w_158h.png
  • 不带长宽: https://img1.tuhu.org/Images/Logo/dazhong.png
  • gif图片(特殊处理,不然会丢失动画): https://img1.tuhu.org/activity/image/ee09/a853/c3bc65b600e58be2597bc0f5_w1080_h321.gif
  • 原始webp图片(不支持webp环境需要反转成jpg): https://img1.tuhu.org/activity/image/ee09/a853/c3bc65b600e58be2597bc0f5_w1080_h321.webp
  • 本身包含@图片(去掉@,重新剪裁): https://img1.tuhu.org/activity/image/5411/22a7/0e866967b380412dd2e6ee76_w1080_h533.png@750w_99q.png
  • 非img.tuhu.org域下图片: https://res.tuhu.org/Activity/dist/img/car.gif