{"id":19359661,"url":"https://github.com/camerakit/jpegkit-android","last_synced_at":"2025-04-23T11:32:47.388Z","repository":{"id":86582165,"uuid":"118440872","full_name":"CameraKit/jpegkit-android","owner":"CameraKit","description":"Efficient JPEG operations for Android without the risk of an OutOfMemoryException.","archived":false,"fork":false,"pushed_at":"2019-01-29T16:12:28.000Z","size":3696,"stargazers_count":163,"open_issues_count":4,"forks_count":33,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-02T14:53:55.511Z","etag":null,"topics":["android","jni","jpeg","jpg","libjpeg-turbo","native","ndk","turbojpeg"],"latest_commit_sha":null,"homepage":"https://www.camerakit.website/jpegkit","language":"C","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/CameraKit.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}},"created_at":"2018-01-22T10:16:27.000Z","updated_at":"2024-03-20T06:43:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ab48faf-dde0-4e3f-a621-9e3f54944009","html_url":"https://github.com/CameraKit/jpegkit-android","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CameraKit%2Fjpegkit-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CameraKit%2Fjpegkit-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CameraKit%2Fjpegkit-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CameraKit%2Fjpegkit-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CameraKit","download_url":"https://codeload.github.com/CameraKit/jpegkit-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250425518,"owners_count":21428575,"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","jni","jpeg","jpg","libjpeg-turbo","native","ndk","turbojpeg"],"created_at":"2024-11-10T07:15:42.206Z","updated_at":"2025-04-23T11:32:46.226Z","avatar_url":"https://github.com/CameraKit.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://camerakit.website/jpegkit\" target=\"_blank\"\u003e\n        \u003cimg alt='JpegKitKit Header' src='.repo/gh-readme-header.png' /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.wonderkiln.com\" target=\"_blank\"\u003e\n        \u003cimg alt='JpegKit Header' src='.repo/gh-readme-wk.png'/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://play.google.com/store/apps/details?id=com.camerakit.jpegkit.demo\u0026hl=en\" target=\"_blank\"\u003e\n        \u003cimg alt='JpegKit Header' src='.repo/gh-readme-app.png'/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://join-slack.camerakit.website\"\u003e\u003cimg src=\"https://join-slack.camerakit.website/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nJpegKit bridges the libjpeg-turbo C++ library into android and wraps it with an easy to use class. You can currently:\n\n- Retrieve metadata such as width and height\n- Rotate the JPEG 90, 180, or 270 degrees\n- Flip the JPEG horizontally\n- Flip the JPEG vertically\n- Crop the JPEG to any `Rect`\n\nThis is all done without decoding the JPEG to RGB. All operations on the JPEG are done in C++ space and does not touch the Java memory, allowing you to work with extremely large JPEGs without the risk of an `OutOfMemoryException`.\n\n## The State Of The Union\nWe've been working on a major update to the JpegKit project that we will dub `v0.3.0`. This release separates concerns away from the single Jpeg class to several classes, each handling different functions of JpegKit. \n\nIn a previous release we deprecated the Jpeg class with the intention of having the new functionality ready for the spotlight. \n\nHowever we discovered some bugs and issues after the initial release. Until `v0.3.0` is finalized, we've un-deprecated that Jpeg class and its other supporting classes. Below is the intended Setup and Usage for `v0.2.2`. \n\n## Setup\nAdd __JpegKit__ to the dependencies block in your `app` level `build.gradle`:\n\n```groovy\t\t\ncompile 'com.camerakit:jpegkit:0.2.2'\n```\n\n## Usage\n\nThe core of JpegKit is the Jpeg class. When creating an object of type `Jpeg`, the constructor expects a `byte[]`. In the future you'll be able to pass just a file.\n\n### Constructor\nFirst, create a `Jpeg`:\n\n```java\nimport jpegkit.Jpeg;\n\n//...\n\nbyte[] jpegBytes = ...;\nJpeg mJpeg = new Jpeg(jpegBytes);\n```\n\nOne can then transform this Jpeg object with the transformations listed in the **Transformations** section below.\n\n\n### Jpeg result\nAfter you perform your transformations, you can get a new JPEG `byte[]` back:\n\n```java\nbyte[] newJpegBytes = mJpeg.getJpeg();\n```\n\nThe `getJpeg()` call can only be used once. At this point our C++ libjpeg-turbo wrapper encodes the new JPEG and also disposes of the original and clears any other memory it used.\n\nTransformations are performed in C++ right when you make the method call, as opposed to doing all after you finish with `getJpeg()`. The transformations will be applied in the order you make the method calls.\n\n## JpegImageView\n\n`JpegImageView` is a view to display JpegKit's `Jpeg` objects.\n\nCreate a `JpegImageView` in **xml** as follows.\n\n```xml\n\u003cjpegkit.JpegImageView\n    android:id=\"@+id/jpegView\"\n    android:layout_width=\"200dp\"\n    android:layout_height=\"200dp\" /\u003e\n```\n\nAccess and set the JPEG from your Activity as follows.\n\n```java\nimport jpegkit.JpegImageView;\n\n//...\n\nJpegImageView jpegView = findViewById(R.id.jpegView)\njpegView.setJpeg(mJpeg);\n```\n\n## Transformations\n### Rotate\n\nAcceptable parameters are `90`, `180`, or `270`.\n\n```java\nmJpeg.rotate(int rotation);\n```\n\n### Flip Horizontal or Vertical\n\nFlip horizontal:\n\n```java\nmJpeg.flipHorizontal();\n```\n\nFlip horizontal:\n\n```java\nmJpeg.flipVertical();\n```\n\n### Crop\n\nCrop extends an `android.graphics.Rect`.\n\n```java\nRect cropRect = new Rect(left, top, right, bottom);\nmJpeg.crop(cropRect);\n```\n\n\n## MetaData\n\nYou can retrieve a JPEGs width, height and size. This only decodes the JPEGs header information and is very fast.\n\n```java\nint width = mJpeg.getWidth();\nint height = mJpeg.getHeight();\nlong size = mJpeg.getJpegSize();\n```\n---\n\n## License\nJpegKit is [MIT License](https://github.com/CameraKit/jpegkit-android/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerakit%2Fjpegkit-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcamerakit%2Fjpegkit-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerakit%2Fjpegkit-android/lists"}