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

react-drawrect

v1.0.2

Published

React draw a detection box on the picture

Downloads

1

Readme

react-drawrect

方便AI能力原子能力展示的个人工具组件,主要功能是图片上绘制box检测框,包含常用的图片数据处理方法(图片转base64,base64转blob,图片合成等)

📦 Install

npm install react-drawrect
yarn add react-drawrect

Templates

-example
	-assets
	-App.js
	-index.html
	-index.js
	-webpack.config.js
-lib
-src
	-components
	-index.js
-.babelrc

🔨 Usage

import React,{ useRef } from "react"
import { ImgDrawRect } from 'react-drawrect';

const App = () => {
  const myRef = useRef();
  return 
    <ImgDrawRect
        lineColor="blue"
        lineWidth={3}
        ref={myRef}
        width={400}
        height={400}
        src={imgSrc}
        option={[{ left: 10, top: 10, width: 20, height: 20 }]}
      />
};

组件可以使用一些canvas处理数据的方法,需要通过ref先获取组件
//获取当前box标记数据
myRef.current.getData()

//设置当前box标记的数据
myRef.current.setData(boxData)

//下载带有检测框的图片
myRef.current.upload()

//清空画布
myRef.current.clearRect()


## 另外,此包中还外置一些获取图片数据的方法,通过import方式导入
import { dataURLToBlob, xxxx } from 'react-drawrect'

dataURLToBlob(base64)  //传入base64,返回blob图片文件数据

getUrlToData(url,type)   //传入图片url,返回对应类型数据,type支持blob和base64

Browsers support

Modern browsers.

| IE / Edge IE / Edge | Firefox Firefox | Chrome Chrome | Safari Safari | Opera Opera | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |