{"id":16908047,"url":"https://github.com/dream2023/antd-image-cropper","last_synced_at":"2025-06-26T20:10:50.184Z","repository":{"id":57180632,"uuid":"380695976","full_name":"dream2023/antd-image-cropper","owner":"dream2023","description":"Another image cropper for Ant Design Upload。antd 图片裁剪组件。","archived":false,"fork":false,"pushed_at":"2021-07-04T14:33:00.000Z","size":1334,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T08:53:46.077Z","etag":null,"topics":["ant-design","antd","crop","crop-image","cropper","image-cropper","react"],"latest_commit_sha":null,"homepage":"https://dream2023.github.io/antd-image-cropper","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dream2023.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-27T09:08:23.000Z","updated_at":"2024-07-31T01:30:20.000Z","dependencies_parsed_at":"2022-09-14T03:30:26.258Z","dependency_job_id":null,"html_url":"https://github.com/dream2023/antd-image-cropper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dream2023/antd-image-cropper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dream2023%2Fantd-image-cropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dream2023%2Fantd-image-cropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dream2023%2Fantd-image-cropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dream2023%2Fantd-image-cropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dream2023","download_url":"https://codeload.github.com/dream2023/antd-image-cropper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dream2023%2Fantd-image-cropper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261119332,"owners_count":23112187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ant-design","antd","crop","crop-image","cropper","image-cropper","react"],"created_at":"2024-10-13T18:49:57.616Z","updated_at":"2025-06-26T20:10:50.146Z","avatar_url":"https://github.com/dream2023.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# antd-image-cropper\n\n另一个图片裁切工具，用于 Ant Design [Upload](https://ant.design/components/upload-cn/) 组件。\n\n[![npm](https://img.shields.io/npm/v/antd-image-cropper.svg?style=flat-square)](https://www.npmjs.com/package/antd-image-cropper)\n[![npm](https://img.shields.io/npm/dt/antd-image-cropper?style=flat-square)](https://www.npmtrends.com/antd-image-cropper)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/antd-image-cropper?style=flat-square)](https://bundlephobia.com/result?p=antd-image-cropper)\n[![GitHub](https://img.shields.io/github/license/dream2023/antd-image-cropper?style=flat-square)](https://github.com/dream2023/antd-image-cropper/blob/master/LICENSE)\n\n## 示例\n\n[在线示例](https://dream2023.github.io/antd-image-cropper)\n\n## 为什么做？\n\n项目需要一个图片裁剪工具，通过搜索发现目前有 [antd-img-crop](https://github.com/nanxiaobei/antd-img-crop) 和 [react-cropper](https://www.npmjs.com/package/react-cropper)，但是 `antd-img-crop` 过于简陋，而 `react-cropper` 依赖了 `cropper.js` 过于大，所以才重新做了一个。\n\n## 安装\n\n```sh\nyarn add antd-image-cropper\n```\n\n## 使用\n\n```jsx\nimport ImageCropper from 'antd-image-cropper'\nimport { Upload } from 'antd'\n\nconst Demo = () =\u003e (\n  \u003cImageCropper\u003e\n    \u003cUpload\u003e+ Add image\u003c/Upload\u003e\n  \u003c/ImageCropper\u003e\n)\n```\n\n## Props\n\n| 属性         | 类型                 | 默认         | 说明                             |\n| ------------ | -------------------- | ------------ | -------------------------------- |\n| crop       | `boolean`             | `true`            | 是否开启裁剪|\n| aspectRatio       | `number`             | -            | 裁切区域宽高比，`width / height` |\n| cropWidth    | `number`             | -            | 裁剪宽度                         |\n| cropHeight   | `number`             | -            | 裁剪高度                         |\n| minWidth     | `number`             | -            | 裁剪区域最小宽度                 |\n| maxWidth     | `number`             | -            | 裁剪区域最大宽度                 |\n| minHeight    | `number`             | -            | 裁剪区域最小高度                 |\n| maxHeight    | `number`             | -            | 裁剪区域最大高度                 |\n| circularCrop | `boolean`            | `false`      | 裁切区域是否为圆形               |\n| grid         | `boolean`            | `false`      | 显示裁切区域网格（九宫格）       |\n| quality      | `number`             | -            | 图片质量，`0 ~ 1`                |\n| modalTitle   | `string`             | `'裁剪图片'` | 弹窗标题                         |\n| modalWidth   | `number` \\| `string` | -            | 弹窗宽度，`px` 的数值或百分比    |\n| modalOk      | `string`             | `'确定'`     | 弹窗确定按钮文字                 |\n| modalCancel  | `string`             | `'取消'`     | 弹窗取消按钮文字                 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdream2023%2Fantd-image-cropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdream2023%2Fantd-image-cropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdream2023%2Fantd-image-cropper/lists"}