{"id":13643994,"url":"https://github.com/yasharpm/InstaCropper","last_synced_at":"2025-04-21T06:32:28.338Z","repository":{"id":18606105,"uuid":"84703450","full_name":"yasharpm/InstaCropper","owner":"yasharpm","description":"A View for cropping images that is similar to Instagram's crop which allows a range of aspect ratios instead of a solid ratio. Also an Activity for cropping is included.","archived":false,"fork":false,"pushed_at":"2022-01-07T09:56:25.000Z","size":137,"stargazers_count":377,"open_issues_count":9,"forks_count":44,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-09T02:31:02.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yasharpm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-12T05:53:04.000Z","updated_at":"2024-12-28T07:19:04.000Z","dependencies_parsed_at":"2022-07-26T23:17:04.755Z","dependency_job_id":null,"html_url":"https://github.com/yasharpm/InstaCropper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasharpm%2FInstaCropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasharpm%2FInstaCropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasharpm%2FInstaCropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasharpm%2FInstaCropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasharpm","download_url":"https://codeload.github.com/yasharpm/InstaCropper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008245,"owners_count":21359954,"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":[],"created_at":"2024-08-02T01:01:55.955Z","updated_at":"2025-04-21T06:32:23.323Z","avatar_url":"https://github.com/yasharpm.png","language":"Java","readme":"#### NOTICE: I build custom views \"for free\". Just send me a description of what you need and I will send it to you the next day! Email me at yasharpm[at]gmail[dot]com with the subject \"CustomView request\".\n\n# InstaCropper\nA View for cropping images that is similar to Instagram's crop. Also an Activity for cropping is included.\n\n![alt tag](https://cloud.githubusercontent.com/assets/4597931/23830368/724ddf70-071e-11e7-9d7e-65615be8d5e6.gif)\n\n## Usage\n\nAdd the dependency:\n```Groovy\ndependencies {\n\timplementation 'com.yashoid:instacropper:1.2.0'\n}\n```\n\n## How to use this library\n\nAdd `InstaCropperView` to your xml layout\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cFrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003ccom.yashoid.instacropper.InstaCropperView\n        android:id=\"@+id/instacropper\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:backgroundColor=\"@android:color/white\" /\u003e\n\n\u003c/FrameLayout\u003e\n```\n\nInstaCropperView receives only Uri but any Uri is possible.\n```java\nmInstaCropper.setImageUri(imageUri);\n```\n\nYou can specify three size ratios for the crop. The narrowest allowed, the widest allowed and the ideal ratio. The View will adjust its size by the ideal ratio.\n```java\nmInstaCropper.setRatios(defaultRatio, minimumRatio, maximumRatio);\n```\n\nThe cropped image is returned in a callback. You can specify MeasureSpec to adjust the width and height of the returned Bitmap.\n```java\nmInstaCropper.crop(\n        View.MeasureSpec.makeMeasureSpec(1024, View.MeasureSpec.AT_MOST),\n        View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),\n        new InstaCropperView.BitmapCallback() {\n\n            @Override\n            public void onBitmapReady(Bitmap bitmap) {\n                // Do something.\n            }\n            \n        }\n);\n```\n\nIt is also possible to use the crop feature via an Intent call. There are various `getIntent()` methods defined on `InstaCropperActivity`. You will then receive the crop result in `data.getData()`.\n```java\nIntent intent = InstaCropperActivity.getIntent(context, srcUri, dstUri, maxWidth, outputQuality);\nstartActivityForResult(intent, REQUEST_CROP);\n```\n\nCropping of multiple images is also possible. Use `MultipleCropActivity.getIntent()` methods to access. If all the images are cropped you will receive `RESULT_OK` otherwise `RESULT_CANCELED`. `EXTRA_COUNT` will contain the number of images cropped.\n```java\nIntent intent = MultipleCropActivity.getIntent(context, srcUris, dstUris, maxWidth, maxHeight, aspectRatio);\nstartActivityForResult(intent, REQUEST_MULTIPLE_CROP);\n```\n\nYou can modify the crop Activity's apprearance by overriding the following resouce values:\n```xml\n\u003cstring name=\"instacropper_title\"\u003eCrop\u003c/string\u003e \u003c!-- Title of toolbar --\u003e\n\u003cstring name=\"instacropper_crop\"\u003eCrop\u003c/string\u003e \u003c!-- Title of crop action in toolbar --\u003e\n\n\u003ccolor name=\"instacropper_cropper_background\"\u003e@android:color/white\u003c/color\u003e \u003c!-- Background color of InstaCropperView in the activity --\u003e\n\u003ccolor name=\"instacropper_crop_color\"\u003e@android:color/black\u003c/color\u003e \u003c!-- Color of crop action in toolbar --\u003e\n\n\u003cstyle name=\"InstaCropper\" parent=\"android:style/Theme.DeviceDefault.Light\"/\u003e \u003c!-- Style of crop Activity --\u003e\n```\n","funding_links":[],"categories":["图片"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasharpm%2FInstaCropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasharpm%2FInstaCropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasharpm%2FInstaCropper/lists"}