Skip to content

fxy5869571/crop-png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crop-png

一个去除 png 图片空白区域的小插件

安装

npm install --save crop-png

使用

import { crop } from "crop-png";

import src from "./cloth_7_3.png";

export default class extends React.Component {
  state = {
    url: ""
  };

  async componentDidMount() {
    // src可以是本地图片或者网络图片
    const url = await crop(src);

    this.setState({ url });
  }

  render() {
    const { url } = this.state;
    return <img src={url} alt="" style={{ width: 100 }} />;
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published