{"id":18622771,"url":"https://github.com/timonus/uiimageheic","last_synced_at":"2025-11-05T01:02:00.677Z","repository":{"id":40990892,"uuid":"106888659","full_name":"timonus/UIImageHEIC","owner":"timonus","description":"UIImage category that adds familiar HEIC encoding.","archived":false,"fork":false,"pushed_at":"2024-03-14T17:54:09.000Z","size":37,"stargazers_count":141,"open_issues_count":4,"forks_count":16,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-12-08T19:11:54.666Z","etag":null,"topics":["heic","heif","ios11","objective-c","uiimage","uikit"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timonus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-14T01:38:09.000Z","updated_at":"2024-09-26T05:52:19.000Z","dependencies_parsed_at":"2022-09-05T02:50:44.219Z","dependency_job_id":null,"html_url":"https://github.com/timonus/UIImageHEIC","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/timonus%2FUIImageHEIC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timonus%2FUIImageHEIC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timonus%2FUIImageHEIC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timonus%2FUIImageHEIC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timonus","download_url":"https://codeload.github.com/timonus/UIImageHEIC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230520390,"owners_count":18238948,"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":["heic","heif","ios11","objective-c","uiimage","uikit"],"created_at":"2024-11-07T04:18:33.685Z","updated_at":"2025-11-05T01:02:00.659Z","avatar_url":"https://github.com/timonus.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UIImageHEIC\n\nApple introduced widespread HEIC support with iOS 11, but the APIs for it are somewhat low level. This tiny project adds a familiar interface for encoding `UIImage`s into HEIC data similar to what we're used to doing with JPEG or PNG data.\n\n## Installation\n\nAdd the UIImage+HEIC.h and UIImage+HEIC.m source files to your project. At the moment you must be using Xcode 9 / building with the iOS 11 SDK to use this.\n\n## Usage\n\n### Converting `UIImage`s to HEIC\n\nThis adds a function named `tj_UIImageHEICRepresentation` that behaves just like `UIImageJPEGRepresentation`. The method returns `nil` in the event that HEIC encoding isn't possible on the current device.\n\nSo, where you used to have\n\n```objc\nUIImage *image = /**/;\nNSData *imageData = UIImageJPEGRepresentation(image, 0.8);\n```\n\nYou could now have\n\n```objc\nUIImage *image = /**/;\nNSData *imageData = tj_UIImageHEICRepresentation(image, 0.8);\nif (imageData.length == 0) {\n    imageData = UIImageJPEGRepresentation(image, 0.8);\n}\n```\n\n### `UIGraphicsImageRenderer` Extensions\n\nThis project also adds a category to `UIGraphicsImageRenderer` for HEIC exporting support with fallbacks to PNG or JPEG. It's used just like you use `UIGraphicsImageRenderer`'s existing PNG and JPEG exporting methods.\n\nBefore\n\n```objc\nUIGraphicsImageRenderer *renderer = /**/;\nNSData *data = [renderer PNGDataWithActions:/**/];\n```\n\nAfter with no fallback\n\n```objc\nUIGraphicsImageRenderer *renderer = /**/;\nNSData *data = [renderer tj_HEICDataWithCompressionQuality:1.0 actions:/**/];\n```\n\nAfter falling back to PNG\n\n```objc\nUIGraphicsImageRenderer *renderer = /**/;\nNSData *data = [renderer tj_HEICDataFallingBackToPNGDataWithCompressionQuality:1.0 actions:/**/];\n```\n\nAfter falling back to JPEG\n\n```objc\nUIGraphicsImageRenderer *renderer = /**/;\nNSData *data = [renderer tj_HEICDataWithCompressionQuality:1.0 fallingBackToJPEGDataWithCompressionQuality:1.0 actions:/**/];\n```\n\n### Checking HEIC images\n\nYou can check if the image at a particular path is a HEIC image using `tj_isImageAtPathHEIC` on devices that support HEIC reading.\n\n```objc\nBOOL isHEICImage = tj_isImageAtPathHEIC(/*path to an image*/);\n```\n\nFor lower level access you can also use `tj_CGImageSourceUTIIsHEIC`, which allows you to check using an image source made from data or a URL, and is also helpful if you want to immediately use the image source to perform a transformation in the event it is HEIC.\n\n```objc\nBOOL isHEICImageSource = tj_CGImageSourceUTIIsHEIC(/*image source*);\n```\n\n## Why Use This \u003e iOS 17?\n\niOS 17 added `UIImageHEICRepresentation`, hooray! You still might want to use this if you would like to generate lossy HEIC images, as `UIImageHEICRepresentation` doesn’t support specifying a compression quality.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimonus%2Fuiimageheic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimonus%2Fuiimageheic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimonus%2Fuiimageheic/lists"}