{"id":15689626,"url":"https://github.com/skypanther/tirotate","last_synced_at":"2025-04-29T18:45:43.191Z","repository":{"id":140291675,"uuid":"78674189","full_name":"skypanther/TiRotate","owner":"skypanther","description":"Titanium Android module","archived":false,"fork":false,"pushed_at":"2018-10-21T13:41:24.000Z","size":4827,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T12:12:32.368Z","etag":null,"topics":["appcelerator","appcelerator-android","titanium-mobile"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/skypanther.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":"2017-01-11T19:55:15.000Z","updated_at":"2018-10-21T13:41:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"8dcbf90c-73ce-4a1d-b32c-0db96cc9de0c","html_url":"https://github.com/skypanther/TiRotate","commit_stats":{"total_commits":3,"total_committers":2,"mean_commits":1.5,"dds":"0.33333333333333337","last_synced_commit":"a74edfd3e7b8691465671ba4d94f936d3a65f37f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skypanther%2FTiRotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skypanther%2FTiRotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skypanther%2FTiRotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skypanther%2FTiRotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skypanther","download_url":"https://codeload.github.com/skypanther/TiRotate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251562552,"owners_count":21609572,"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":["appcelerator","appcelerator-android","titanium-mobile"],"created_at":"2024-10-03T18:03:46.821Z","updated_at":"2025-04-29T18:45:43.174Z","avatar_url":"https://github.com/skypanther.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nTiRotate - Android Image Rotation Module\n===========================================\n\nIs it a Titanium bug or an Android bug or a handset-maker bug? Who cares. Sometimes you take a photo with your phone upright (portrait) and it ends up sideways. This module is meant to fix that.\n\nThe TiRotate module will rotate an image to an orientation you specify and set its EXIF orientation tag to reflect that orientation (so that web clients, etc. will respect the new orientation).\n\nNote: *This module doesn't support free rotation. You can rotate to any of the cardinal coordinates -- portrait, landscape right, upside-down, landscape left.*\n\n\nObtaining / Installing\n-------------\n\n### Recommended\n\n```shell\n$ gittio install com.skypanther.tirotate\n```\n\n###Manual method (works, but why not use gittio?):\n\n1. Download the zip from the dist folder\n2. Unzip to your app's modules/android folder\n3. Add the module to the modules tag:\n\n```xml\n\u003cmodules\u003e\n\t\u003cmodule platform=\"android\"\u003ecom.skypanther.tirotate\u003c/module\u003e\n\u003c/modules\u003e\n```\n\nUsing\n-------------\n\nIn your controller, instantiate it and use it:\n\n```\nvar tirotate = require('com.skypanther.tirotate');\nvar file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'photo.jpg');\nvar orientation = tirotate.getExifOrientation(file.nativePath);\nif (orientation === tirotate.ORIENTATION_NORMAL) {\n\talert(\"The image is portrait\");\n}\n```\n\n### Methods\n\n| Method | Description |\n|--------|-------------|\n|`getExifOrientationDegrees(path)` | Get the image's EXIF orientation in degrees | \n|`getExifOrientation(path)` | Get the image's EXIF orientation tag value | \n|`setExifOrientation(path, targetOrientation)` | Set the image's EXIF orientation tag | \n|`rotate(path, targetOrientation)` |  Rotates the image to specified orientation *and* updates its EXIF tag |\n\n#### Examples:\n\n**Get the orientation of an image file in degrees**\n\n```\ntirotate.getExifOrientationDegrees(file.nativePath); // e.g. 90\n```\n\n**Get the EXIF orientation tag value**\n\n```\ntirotate.getExifOrientation(file.nativePath); // 1 (ORIENTATION_NORMAL)\n```\n(The resulting value will match the constants defined by the native ExifInterface. See [https://developer.android.com/reference/android/media/ExifInterface.html](https://developer.android.com/reference/android/media/ExifInterface.html) for those values.)\n\n\n**Set the EXIF orientation tag value**\n\n```\ntirotate.setExifOrientation(file.nativePath, tirotate.PORTRAIT);\n```\n\nAlternatively:\n\n```\ntirotate.setExifOrientation(file.nativePath, tirotate.ORIENTATION_NORMAL);\n```\n\n**Rotate the image AND set its EXIF tag to the new orientation**\n\n```\nif (tirotate.rotate(file.nativePath, tirotate.PORTRAIT)) {\n\t// successfully rotated\n} else {\n\t// failed to rotate\n}\n```\n\nAlternatively:\n\n\n```\nif (tirotate.rotate(file.nativePath, tirotate.ORIENTATION_NORMAL)) {\n\t// successfully rotated\n} else {\n\t// failed to rotate\n}\n```\n\n### Constants\n\nThe module defines a few constants that you should use when interacting with images via the module's methods. For example, assuming you instantiate the module in a variable `tirotate` you would reference the EXIF portrait orientation as `tirotate.ORIENTATION_NORMAL`\n\n|Constant|Description|Value|\n|---|---|---|\n| `DEGREES_PORTRAIT` | Integer rotation, used when reading the EXIF orientation of an image | 0 |\n| `DEGREES_LANDSCAPE_RIGHT` | Integer rotation, used when reading the EXIF orientation of an image | 90 |\n| `DEGREES_UPSIDE_PORTRAIT` | Integer rotation, used when reading the EXIF orientation of an image | 180 |\n| `DEGREES_LANDSCAPE_LEFT` | Integer rotation, used when reading the EXIF orientation of an image | 270 |\n| `PORTRAIT` | String used when rotating an image to a specific orientation | \"portrait\" |\n| `LANDSCAPE_RIGHT` | String used when rotating an image to a specific orientation | \"landscape_right\" |\n| `UPSIDE_PORTRAIT` | String used when rotating an image to a specific orientation | \"upside_portrait\" |\n| `LANDSCAPE_LEFT` | String used when rotating an image to a specific orientation | \"landscape_left\" |\n| `ORIENTATION_NORMAL` | Corresponds to the EXIF orientation constant for the portrait orientation | ExifInterface.ORIENTATION_NORMAL |\n| `ORIENTATION_ROTATE_90` | Corresponds to the EXIF orientation constant for the landscape right orientation | ExifInterface.ORIENTATION_ROTATE_90 |\n| `ORIENTATION_ROTATE_180` | Corresponds to the EXIF orientation constant for the upside-down orientation | ExifInterface.ORIENTATION_ROTATE_180 |\n| `ORIENTATION_ROTATE_270` | Corresponds to the EXIF orientation constant for the landscape left orientation | ExifInterface.ORIENTATION_ROTATE_270 |\n| `ORIENTATION_UNDEFINED` | Corresponds to the EXIF orientation constant for the undefined orientation | ExifInterface.ORIENTATION_UNDEFINED |\n\n\nContributing\n-------------------\n\nI welcome any and all help, naturally. I could specifically use testing on various Android devices. Open issues, or even better, submit a pull request.\n\nLicense \u0026 Copyright\n-------------------------\n\nCopyright \u0026copy; 2017 Tim Poulsen distributed under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskypanther%2Ftirotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskypanther%2Ftirotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskypanther%2Ftirotate/lists"}