{"id":21904034,"url":"https://github.com/m1ga/ti.imagecrop","last_synced_at":"2025-10-31T18:01:57.630Z","repository":{"id":80614897,"uuid":"397602466","full_name":"m1ga/ti.imagecrop","owner":"m1ga","description":"Titanium image crop for Android","archived":false,"fork":false,"pushed_at":"2023-01-19T12:04:34.000Z","size":190,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T01:13:03.608Z","etag":null,"topics":["android","titanium","titanium-mobile","titanium-module"],"latest_commit_sha":null,"homepage":"","language":"Java","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/m1ga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"m1ga"}},"created_at":"2021-08-18T13:02:16.000Z","updated_at":"2023-01-16T14:14:07.000Z","dependencies_parsed_at":"2023-07-08T02:45:59.823Z","dependency_job_id":null,"html_url":"https://github.com/m1ga/ti.imagecrop","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m1ga%2Fti.imagecrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m1ga%2Fti.imagecrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m1ga%2Fti.imagecrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m1ga%2Fti.imagecrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m1ga","download_url":"https://codeload.github.com/m1ga/ti.imagecrop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153909,"owners_count":21221330,"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","titanium","titanium-mobile","titanium-module"],"created_at":"2024-11-28T15:31:02.395Z","updated_at":"2025-10-31T18:01:52.582Z","avatar_url":"https://github.com/m1ga.png","language":"Java","readme":"# Titanium Image Cropping Tool (Android)\n\nAndroid image crop based on: https://github.com/CanHub/Android-Image-Cropper\n\n\u003cimg src=\"assets/screenshot.jpg\"/\u003e\n\nFor the \u003cb\u003eiOS version\u003c/b\u003e have a look at https://github.com/hansemannn/titanium-image-crop\n\n## 📢 Attention:\nYou have to use a `lifecycleContainer` like this:\n```javascript\nvar ImageCrop = require('ti.imagecrop').createImageCrop({\n\tlifecycleContainer: win\n});\n```\n\n## Methods:\n\n* `createImageCrop`\n\t* Paremeter:\n\t\t* lifecycleContainer\n\t\t* showCamera: when `showCropDialog` - `image` is empty it will show/hide the camera option\n\t\t* showGallery: when `showCropDialog` - `image` is empty it will show/hide the gallery option\n\t\t* blob: pass in a blob if use it as a view\n\n* `showCropDialog`\n\t* Parameters:\n\t\t- `image` (String) - path to file; if empty it will show an image picker\n\n* `cropImage`\n * returns blob\n\nYou can now use it as a normal View and load a blob in it:\n```js\nicv = require('ti.imagecrop').createImageCrop({\n\twidth: 300,\n\theight: 300,\n\tblob: yourBlob\n});\nwin.add(icv);\n```\n## Properties\n\n* `rotation`: rotate the crop view\n\n## Events:\n\n* `done`\n\t* Parameter: `image` (TiBlob) - cropped image\n* `cancel`\n\n\n## Example:\n\n```javascript\nconst win = Ti.UI.createWindow();\nconst img = Ti.UI.createImageView({\n\ttop: 90\n});\nconst btn = Ti.UI.createButton({\n\ttitle: \"crop image (Ti picker)\",\n\tbottom: 0\n});\nconst btn2 = Ti.UI.createButton({\n\ttitle: \"select image (module picker)\",\n\tbottom: 50\n});\nconst btn3 = Ti.UI.createButton({\n\ttitle: \"crop image (blob, view)\",\n\tbottom: 100\n});\n\nconst btnCrop = Ti.UI.createButton({\n\ttop: 40,\n\ttitle: \"crop\",\n})\nvar icv = null;\nbtnCrop.addEventListener(\"click\", function() {\n\tif (icv != null) {\n\t\tlet blob = icv.cropImage();\n\t\timg.image = blob;\n\t\timg.width = blob.width;\n\t\timg.height = blob.height;\n\t\twin.remove(icv);\n\t\ticv = null;\n\t}\n})\nconst slider = Ti.UI.createSlider({\n\ttop: 10,\n\tmin: -180,\n\tmax: 180,\n\tvalue: 0\n})\n\nconst ImageCrop = require('ti.imagecrop').createImageCrop({\n\tlifecycleContainer: win,\n\t// showCamera: true,\n\t// showGallery: true\n});\nImageCrop.addEventListener(\"done\", function(e) {\n\timg.image = e.image;\n});\nImageCrop.addEventListener(\"cancel\", function(e) {\n\talert(\"cancel\");\n});\n\n\nwin.add([img, btn, btn2, btn3, btnCrop, slider]);\nbtn.addEventListener(\"click\", function() {\n\tTi.Media.openPhotoGallery({\n\t\tsuccess: function(e) {\n\t\t\t// crop image\n\t\t\tImageCrop.showCropDialog({\n\t\t\t\timage: e.media.nativePath\n\t\t\t})\n\t\t}\n\t})\n})\nslider.addEventListener(\"change\", function() {\n\tif (icv) {\n\t\ticv.rotation = slider.value\n\t}\n})\nbtn2.addEventListener(\"click\", function() {\n\t// show image picker\n\tImageCrop.showCropDialog({})\n})\n\n\nbtn3.addEventListener(\"click\", function() {\n\t// download file and use crop view\n\tlet client = Titanium.Network.createHTTPClient({\n\t\tonload: function() {\n\t\t\ticv = require('ti.imagecrop').createImageCrop({\n\t\t\t\twidth: 300,\n\t\t\t\theight: 300,\n\t\t\t\tblob: this.responseData\n\t\t\t});\n\t\t\twin.add(icv);\n\t\t},\n\t\ttimeout: 30000\n\t});\n\tclient.open('GET', 'https://picsum.photos/300/300');\n\tclient.send();\n});\n\nwin.open();\n\n```\n\n## TODO\n\n`Android-Image-Cropper` has lots of customization options (e.g. disable/allow rotation, predefined ratios).\n\n## Author\nMichael Gangolf (\u003ca href=\"https://github.com/m1ga\"\u003e@MichaelGangolf\u003c/a\u003e / \u003ca href=\"https://www.migaweb.de\"\u003eWeb\u003c/a\u003e)\n\n\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://www.buymeacoffee.com/miga\" title=\"donate\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coke-donate-orange.svg\" alt=\"Buy Me A Coke donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n","funding_links":["https://github.com/sponsors/m1ga","https://www.buymeacoffee.com/miga"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm1ga%2Fti.imagecrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm1ga%2Fti.imagecrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm1ga%2Fti.imagecrop/lists"}