{"id":29103310,"url":"https://github.com/callstack/react-native-image-editor","last_synced_at":"2025-06-28T23:42:00.717Z","repository":{"id":40293833,"uuid":"169579260","full_name":"callstack/react-native-image-editor","owner":"callstack","description":"A library providing an API for cropping images from the web and the local file system.","archived":false,"fork":false,"pushed_at":"2025-04-03T12:16:47.000Z","size":1791,"stargazers_count":413,"open_issues_count":11,"forks_count":120,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-25T18:50:52.065Z","etag":null,"topics":["android","ios","react-native","web"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/callstack.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-07T13:51:24.000Z","updated_at":"2025-06-24T10:21:09.000Z","dependencies_parsed_at":"2024-02-20T11:44:24.761Z","dependency_job_id":"62117755-29b2-4f41-8304-895f80a8d433","html_url":"https://github.com/callstack/react-native-image-editor","commit_stats":{"total_commits":91,"total_committers":35,"mean_commits":2.6,"dds":0.5934065934065934,"last_synced_commit":"23f2d5e49ed3bc4d4554cfa05a31e15de76e2d00"},"previous_names":["react-native-community/react-native-image-editor"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/callstack/react-native-image-editor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-image-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-image-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-image-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-image-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/callstack","download_url":"https://codeload.github.com/callstack/react-native-image-editor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-image-editor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262513662,"owners_count":23322665,"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":["android","ios","react-native","web"],"created_at":"2025-06-28T23:41:52.451Z","updated_at":"2025-06-28T23:42:00.705Z","avatar_url":"https://github.com/callstack.png","language":"Kotlin","readme":"# @react-native-community/image-editor\n\n[![Build Status][build-badge]][build]\n[![Version][version-badge]][package]\n[![MIT License][license-badge]][license]\n[![PRs Welcome][prs-welcome-badge]][prs-welcome]\n[![Lean Core Badge][lean-core-badge]][lean-core-issue]\n\nImage Editor Native module for React Native.\n\nOriginally extracted from React Native [`issue#23313`](https://github.com/facebook/react-native/issues/23313) and maintained by the community.\n\n## Getting started\n\n### Install\n\n```shell\nyarn add @react-native-community/image-editor\n# or\nnpm install @react-native-community/image-editor --save\n```\n\n### Install Pods\n\n```shell\nnpx pod-install\n```\n\n## Usage\n\nStart by importing the library:\n\n```ts\nimport ImageEditor from '@react-native-community/image-editor';\n```\n\n### Crop image\n\nCrop the image specified by the URI param. If URI points to a remote image, it will be downloaded automatically. If the image cannot be loaded/downloaded, the promise will be rejected.\n\nIf the cropping process is successful, the resultant cropped image will be stored in the cache path, and the [`CropResult`](#result-cropresult) returned in the promise will point to the image in the cache path. ⚠️ Remember to delete the cropped image from the cache path when you are done with it.\n\n```ts\nImageEditor.cropImage(uri, cropData).then((result) =\u003e {\n  console.log('Cropped image uri:', result.uri);\n});\n```\n\n### `cropData: ImageCropData`\n\n| Name                            | Type                                            | Description                                                                                                                                                                                                  |\n| ------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `offset`                        | `{ x: number, y: number }`                      | The top-left corner of the cropped image, specified in the original image's coordinate space                                                                                                                 |\n| `size`                          | `{ width: number, height: number }`             | Size (dimensions) of the cropped image                                                                                                                                                                       |\n| `displaySize`\u003cbr\u003e_(optional)_   | `{ width: number, height: number }`             | Size to which you want to scale the cropped image                                                                                                                                                            |\n| `resizeMode`\u003cbr\u003e_(optional)_    | `'contain' \\| 'cover' \\| 'stretch' \\| 'center'` | Resizing mode to use when scaling the image (iOS only, Android resize mode is always `'cover'`, Web - no support) \u003cbr/\u003e**Default value**: `'cover'`                                                          |\n| `quality`\u003cbr\u003e_(optional)_       | `number`                                        | A value in range `0.0` - `1.0` specifying compression level of the result image. `1` means no compression (highest quality) and `0` the highest compression (lowest quality) \u003cbr/\u003e**Default value**: `0.9`   |\n| `format`\u003cbr\u003e_(optional)_        | `'jpeg' \\| 'png' \\| 'webp'`                     | The format of the resulting image.\u003cbr/\u003e **Default value**: based on the provided image;\u003cbr\u003eif value determination is not possible, `'jpeg'` will be used as a fallback.\u003cbr/\u003e`'webp'` isn't supported by iOS. |\n| `includeBase64`\u003cbr\u003e_(optional)_ | `boolean`                                       | Indicates if Base64 formatted picture data should also be included in the [`CropResult`](#result-cropresult). \u003cbr/\u003e**Default value**: `false`                                                                |\n| `headers`\u003cbr\u003e_(optional)_       | `object \\| Headers`                             | An object or [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) interface representing the HTTP headers to send along with the request for a remote image.                                |\n\n### `result: CropResult`\n\n| Name                     | Type     | Description                                                                                                                                                                                    |\n| ------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `uri`                    | `string` | The path to the image file (example: `'file:///data/user/0/.../image.jpg'`)\u003cbr\u003e **WEB:** `uri` is the data URI string (example `'data:image/jpeg;base64,/4AAQ...AQABAA'`)                      |\n| `path`                   | `string` | The URI of the image (example: `'/data/user/0/.../image.jpg'`)\u003cbr\u003e **WEB:** `path` is the blob URL (example `'blob:https://example.com/43ff7a16...e46b1'`)                                     |\n| `name`                   | `string` | The name of the image file. (example: `'image.jpg'`)                                                                                                                                           |\n| `width`                  | `number` | The width of the image in pixels                                                                                                                                                               |\n| `height`                 | `number` | Height of the image in pixels                                                                                                                                                                  |\n| `size`                   | `number` | The size of the image in bytes                                                                                                                                                                 |\n| `type`                   | `string` | The MIME type of the image (`'image/jpeg'`, `'image/png'`, `'image/webp'`)                                                                                                                     |\n| `base64`\u003cbr\u003e_(optional)_ | `string` | The base64-encoded image data example: `'/9j/4AAQSkZJRgABAQAAAQABAAD'`\u003cbr\u003eif you need data URI as the `source` for an `Image` element for example, you can use `data:${type};base64,${base64}` |\n\nFor more advanced usage check our [example app](/example/src/App.tsx).\n\n\u003c!-- badges --\u003e\n\n[build-badge]: https://github.com/callstack/react-native-image-editor/actions/workflows/main.yml/badge.svg\n[build]: https://github.com/callstack/react-native-image-editor/actions/workflows/main.yml\n[version-badge]: https://img.shields.io/npm/v/@react-native-community/image-editor.svg\n[package]: https://www.npmjs.com/package/@react-native-community/image-editor\n[license-badge]: https://img.shields.io/npm/l/@react-native-community/image-editor.svg\n[license]: https://opensource.org/licenses/MIT\n[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg\n[prs-welcome]: http://makeapullrequest.com\n[lean-core-badge]: https://img.shields.io/badge/Lean%20Core-Extracted-brightgreen.svg\n[lean-core-issue]: https://github.com/facebook/react-native/issues/23313\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallstack%2Freact-native-image-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcallstack%2Freact-native-image-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallstack%2Freact-native-image-editor/lists"}