{"id":1438,"url":"https://github.com/metasmile/NSGIF2","last_synced_at":"2025-08-02T04:31:12.015Z","repository":{"id":62448642,"uuid":"55125879","full_name":"metasmile/NSGIF2","owner":"metasmile","description":"Convert live photos and videos into animated GIFs in iOS, or extract frames from them.","archived":false,"fork":true,"pushed_at":"2018-12-04T11:25:41.000Z","size":1029,"stargazers_count":83,"open_issues_count":5,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-14T11:53:08.980Z","etag":null,"topics":["animated-gif","gif","gif-library"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"NSRare/NSGIF","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metasmile.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}},"created_at":"2016-03-31T06:26:32.000Z","updated_at":"2025-01-13T15:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/metasmile/NSGIF2","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/metasmile/NSGIF2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metasmile%2FNSGIF2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metasmile%2FNSGIF2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metasmile%2FNSGIF2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metasmile%2FNSGIF2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metasmile","download_url":"https://codeload.github.com/metasmile/NSGIF2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metasmile%2FNSGIF2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334611,"owners_count":24233793,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["animated-gif","gif","gif-library"],"created_at":"2024-01-05T20:15:46.471Z","updated_at":"2025-08-02T04:31:11.671Z","avatar_url":"https://github.com/metasmile.png","language":"Objective-C","funding_links":[],"categories":["Media"],"sub_categories":["GIF","Other free courses"],"readme":"![NSGIF2](https://raw.githubusercontent.com/metasmile/NSGIF2/master/title.png?v=2)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/vsouza/awesome-ios#gif)\n[![Stories in Ready](https://badge.waffle.io/metasmile/NSGIF2.svg?label=ready\u0026title=Tasks)](http://waffle.io/metasmile/NSGIF2)\n\nCreate a GIF from the provided video file url, Or extract images from videos.\n\n*This repository has been separated from original repo along with some nontrivial different features, designs, and improvements. Please do diff each other, and visit [original repo](https://github.com/NSRare/NSGIF) for more information if you need.*\n\n## Installation\n\n### Framework Requirements\n\n```\nAccelerate.framework\n```\n\nThere are 2 ways you can add NSGIF to your project:\n\n### Manual\n\nSimply import the 'NSGIF' into your project then import the following in the class you want to use it:\n```objective-c\n#import \"NSGIF.h\"\n```      \n### From CocoaPods\n\n```ruby\npod \"NSGIF2\"\n```\n\n## Usage - GIF from a video\n\nDefault request automatically set essential options such as the best frame count, delay time, output temp file name, or size. see interface file for more options.\n\n### Write 1 line to export\n```objective-c\n[NSGIF create:[NSGIFRequest requestWithSourceVideo:tempVideoFileURL] completion:^(NSURL *GifURL) {\n    //GifURL is to nil if it failed or stopped.\n}];\n```\n\n### If you need more.\n```objective-c\nNSGIFRequest * request = [NSGIFRequest requestWithSourceVideo:tempVideoFileURL destination:gifFileURL];\nrequest.progressHandler = ^(double progress, NSUInteger position, NSUInteger length, CMTime time, BOOL *stop, NSDictionary *frameProperties) {\n    NSLog(@\"%f - %lu - %lu - %lld - %@\", progress, position, length, time.value, frameProperties);\n};\n\n[NSGIF create:request completion:^(NSURL *GifURL) {\n    //GifURL is to nil if it failed or stopped.\n}];\n```\n\n### Interrupt process for given request\n```objective-c\nrequest.progressHandler = ^(double progress, NSUInteger position, NSUInteger length, CMTime time, BOOL *stop, NSDictionary *frameProperties) {\n    BOOL cancelationCondition = YES;\n    if(cancelationCondition){\n        *stop = YES;\n    }\n};\n```\n\n## Options - NSGIFRequest\n```objective-c\n/* required.\n * a file's url of source video */\n@property(nullable, nonatomic) NSURL * sourceVideoFile;\n\n/* optional.\n * defaults to nil.\n * automatically assign the file name of source video (ex: IMG_0000.MOV -\u003e IMG_0000.gif)  */\n@property(nullable, nonatomic) NSURL * destinationVideoFile;\n\n/* optional but important.\n * Defaults to NSGIFScaleOptimize (not set).\n * This option will affect gif file size, memory usage and processing speed. */\n@property(nonatomic, assign) NSGIFScale scalePreset;\n\n/* optional but important.\n * Defaults to 4.\n * number of frames in seconds.\n * This option will affect gif file size, memory usage and processing speed. */\n@property(nonatomic, assign) NSUInteger framesPerSecond;\n\n/* optional but defaults is recommended.\n * Defaults is to not set.\n * How far along the video track we want to move, in seconds. It will automatically assign from duration of video and framesPerSecond. */\n@property(nonatomic, assign) NSUInteger frameCount;\n\n/* optional.\n * Defaults to 0,\n * the number of times the GIF will repeat. which means repeat infinitely. */\n@property(nonatomic, assign) NSUInteger loopCount;\n\n/* optional.\n * Defaults to 0.13.\n * unit is 10ms, 1/100s, the amount of time for each frame in the GIF.\n * This option will NOT affect gif file size, memory usage and processing speed. It affect only FPS. */\n@property(nonatomic, assign) CGFloat delayTime;\n\n/* optional.\n * Defaults is to not set. unit is seconds, which means unlimited */\n@property(nonatomic, assign) NSTimeInterval maxDuration;\n\n/* optional.\n * Defaults is to not set.\n * This option will crop(via AspectFill Mode) fast while create each images. Their size will be automatically calculated.\n * ex)\n *  square  : aspectRatioToCrop = CGSizeMake(1,1)\n *  16:9    : aspectRatioToCrop = CGSizeMake(16,9) */\n@property(nonatomic, assign) CGSize aspectRatioToCrop;\n\n/* optional.\n * Defaults is nil */\n@property (nonatomic, copy, nullable) NSGIFProgressHandler progressHandler;\n\n/* gif creation job is now proceeding */\n@property(atomic, readonly) BOOL proceeding;\n```\n\n## Usage - Extract each frames from a video to images.\n\n```objective-c\nNSFrameExtractingRequest * request = [NSFrameExtractingRequest requestWithSourceVideo:videoURL];\nrequest.progressHandler = ^(double progress, NSUInteger offset, NSUInteger length, CMTime time, BOOL *stop, NSDictionary *frameProperties) {\n    // normalized progress, Zero to 1.\n};\nrequest.framesPerSecond = 2;\n\n[NSGIF extract:request completion:^(NSArray\u003cNSURL *\u003e *extractedFrameImageUrls) {\n    //complete.\n}];\n```\n\n## Options - NSFrameExtractingRequest\n```objective-c\n/* required.\n * a file's url of source video */\n@property(nullable, nonatomic) NSURL * sourceVideoFile;\n\n/* optional.\n * defaults to temp directory.\n */\n@property(nullable, nonatomic) NSURL * destinationDirectory;\n\n/* optional.\n * Defaults to jpg.\n * This property will be affect to UTType(Automatically detected) of extracting image file.\n */\n@property(nonatomic, readwrite, nullable) NSString * extension;\n\n/* optional but important.\n * Defaults to NSGIFScaleOptimize (not set).\n * This option will affect gif file size, memory usage and processing speed. */\n@property(nonatomic, assign) NSGIFScale scalePreset;\n\n/* optional.\n * Defaults is to not set. unit is seconds, which means unlimited */\n@property(nonatomic, assign) NSTimeInterval maxDuration;\n\n/* optional but important.\n * Defaults to 4.\n * number of frames in seconds.\n * This option will affect gif file size, memory usage and processing speed. */\n@property(nonatomic, assign) NSUInteger framesPerSecond;\n\n/* optional but defaults is recommended.\n * Defaults is to not set.\n * How far along the video track we want to move, in seconds. It will automatically assign from duration of video and framesPerSecond. */\n@property(nonatomic, assign) NSUInteger frameCount;\n\n/* optional.\n * Defaults is to not set.\n * This option will crop(via AspectFill Mode) fast while create each images. Their size will be automatically calculated.\n * ex)\n *  square  : aspectRatioToCrop = CGSizeMake(1,1)\n *  16:9    : aspectRatioToCrop = CGSizeMake(16,9) */\n@property(nonatomic, assign) CGSize aspectRatioToCrop;\n\n/* optional.\n * Defaults is nil */\n@property (nonatomic, copy, nullable) NSGIFProgressHandler progressHandler;\n\n/* readonly\n * status for gif creating job 'YES' equals to 'now proceeding'\n */\n@property(atomic, readonly) BOOL proceeding;\n```\n\n## In the future, I will add a feature that can\n\n* create from a provided photo url.\n* perform simultaneous processing with provided specific chunk size.\n* seek for specific point.\n* generate infinite lengh of GIFs (Split with specific chunk size -\u003e encoding -\u003e merge each encoded piece of gifs.)\n* use APIs which is pefectly similar with PhotosKit of iOS.\n\nPull requests are more than welcomed!\n\n## License\nUsage is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetasmile%2FNSGIF2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetasmile%2FNSGIF2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetasmile%2FNSGIF2/lists"}